15 Commits

Author SHA1 Message Date
e8d4d6596e cafe-1.16.1 2022-08-04 10:19:32 +02:00
2170202fc9 version 1.15.0; added ca, epics4 version methods 2022-03-11 16:32:51 +01:00
9a18453b41 reset status in getCache following put with nowtaccess error 2021-10-14 19:37:59 +02:00
f97beb8edf 2020b LD_PRELOAD 2021-06-15 16:19:04 +02:00
32ed13125d cafe-1.13.0 2021-03-22 12:41:12 +01:00
90d82bec7a cafe-1.12.5 release 2021-03-16 09:35:10 +01:00
0343a1e1e3 reformat mex file 2019-01-03 09:52:11 +01:00
09085d814c README 2018-12-19 12:18:19 +01:00
624d52d419 cleaned git cache 2018-12-19 12:15:59 +01:00
558222585f cleaned git cache 2018-12-19 12:09:53 +01:00
2e7abe48eb rm cached 2018-12-14 15:59:00 +01:00
f351a0d5bb new release 2018-12-14 15:55:17 +01:00
e31fed82be open methods refined - removed print statements 2017-11-23 10:36:53 +01:00
0aeb952d62 open methods refined 2017-11-22 14:15:37 +01:00
6dfd64a9a3 Connection time optimized 2017-11-14 09:24:20 +01:00
21 changed files with 9762 additions and 8048 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,10 @@
*~
*.bak
*.*-
RHEL7-x86_64
SL6-x86_64
windows-x64
felix-cache
readme.txt
makefile_rel*
*.*.orig

233
.matlab7rc.sh-original Executable file
View File

@@ -0,0 +1,233 @@
#
# usage: .matlab7rc.sh
#
# abstract: This Bourne Shell script is sourced by the matlab script
# to obtain certain site/user dependent information
# as explained below. The first occurrence of this file
# in the directory list:
#
# . (current)
# $HOME (home)
# matlab/bin (default location)
#
# is used. Most of the time this file in the default location
# need not be modified at all and nothing needs to be done.
# However, if MATLAB does not work properly with the default
# values then this file may need to be modified and different
# values inserted.
#
# Currently, the following variables appear in the code below.
#
# ARCH (machine architecture)
# DISPLAY (DISPLAY variable for X Window System)
# LDPATH_PREFIX (path(s) that appear at the start of
# LD_LIBRARY_PATH)
# LDPATH_SUFFIX (path(s) that appear at the end of
# LD_LIBRARY_PATH)
# LD_LIBRARY_PATH (load library path - the name
# LD_LIBRARY_PATH is platform dependent)
# MATLAB (MATLAB root directory)
# MATLABPATH (MATLAB search path)
# SHELL (which shell to use for ! and unix
# command in MATLAB)
# TOOLBOX (toolbox path)
#
# NOTE: Run matlab -n to get the values used to run MATLAB.
# MATLAB is NOT executed.
#
# Additional variables are used in the MATLAB script, but
# to affect their behavior from this file requires an
# understanding first of how they are determined in the
# MATLAB script and then making code modifications to this
# file.
#
# The strategy behind the use of this file is to keep
# the site wide changes in the matlab/bin/.matlab7rc.sh version
# and have the individual user start with a copy in their
# $HOME directory and modify it for their special circumstances.
#
# IMPORTANT: Please understand that The MathWorks cannot
# anticipate every possible installation. If
# your situation does not fit into the current
# model of using this .matlab7rc.sh file then
# we would like to hear from you. Please
# contact The MathWorks Technical Support.
#
# note(s): 1. The default values are
#
# ARCH (machine architecture)
#
# This is the machine architecture determined by
# the arch utility script.
#
# DISPLAY (DISPLAY variable for X Window System)
#
# This is set to "$DISPLAY" where DISPLAY is
# taken from the environment.
#
# LDPATH_PREFIX (path(s) that appear at the
# start of LD_LIBRARY_PATH)
#
# Enclose in single quotes to defer evaluation
# to the MATLAB script.
#
# LDPATH_SUFFIX (path(s) that appear at the
# end of LD_LIBRARY_PATH)
#
# Enclose in single quotes to defer evaluation
# to the MATLAB script.
#
# LD_LIBRARY_PATH (load library path - the name
# LD_LIBRARY_PATH is platform
# dependent)
#
# TABLE:
#
# platform variable name
# -------- -------------
# glnxa64 LD_LIBRARY_PATH
# maci64 DYLD_LIBRARY_PATH
#
# NOTE: The final load library path determined
# in the MATLAB startup script is composed
# of:
#
# ------------------------------------------------------------
# LDPATH_PREFIX:<matlab_additions>:LD_LIBRARY_PATH:\
# <system_additions>:LDPATH_SUFFIX
# ------------------------------------------------------------
#
# This means to add paths between:
# 1. <matlab_additions> and LD_LIBRARY_PATH
# put them in front of LD_LIBRARY_PATH
# 2. LD_LIBRARY_PATH and <system_additions>
# put them at the end of LD_LIBRARY_PATH
#
# MATLAB (MATLAB root directory)
#
# MATLABPATH (MATLAB search path)
#
# This is set to "$MATLABPATH" where MATLABPATH is
# taken from the environment.
#
# SHELL (which shell to use for ! or
# unix command in MATLAB)
#
# This is set to "$SHELL" where SHELL is taken from
# the environment. If SHELL is empty or not defined
# then MATLAB uses /bin/sh internally.
#
# TOOLBOX (toolbox path)
#
# This is set to "$TOOLBOX" where TOOLBOX is
# taken from the environment.
#
# Copyright 1986-2016 The MathWorks, Inc.
#----------------------------------------------------------------------------
#
# Determine the arch.
#
# -------------------------------------------------------------
#
MATLAB_UTIL_DIR=
#
# -------------------------------------------------------------
#
if [ ! "$MATLAB_UTIL_DIR" ]; then
MATLAB_UTIL_DIR=$MATLAB_UTIL_DIRdefault
fi
#
MATLAB="$MATLABdefault"
#
. "$MATLAB_UTIL_DIR/arch.sh"
if [ "$ARCH" = "unknown" ]; then
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo ''
echo ' Sorry! We could not determine the machine architecture for your'
echo ' host. Please contact:'
echo ''
echo ' MathWorks Technical Support'
echo ''
echo ' for further assistance.'
echo ''
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
trap ""
exit 1
fi
#
# IMPORTANT! Modify ONLY if you don't like the defaults after running
# MATLAB.
#
case "$ARCH" in
glnx*)
#----------------------------------------------------------------------------
AUTOMOUNT_MAP=''
DISPLAY="$DISPLAY"
ARCH="$ARCH"
TOOLBOX="$TOOLBOX"
MATLABPATH="$MATLABPATH"
SHELL="$SHELL"
LDPATH_PREFIX=''
#
# To always use the OpenGL libraries shipped with MATLAB uncomment the next
# line.
#
# LDPATH_PREFIX='$MATLAB/sys/opengl/lib/$ARCH'
#
LDPATH_SUFFIX=''
#
if [ "$LD_LIBRARY_PATH" != "" ]; then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=
fi
#----------------------------------------------------------------------------
;;
mac*)
AUTOMOUNT_MAP=''
DISPLAY="$DISPLAY"
ARCH="$ARCH"
TOOLBOX="$TOOLBOX"
MATLABPATH="$MATLABPATH"
SHELL="$SHELL"
LDPATH_PREFIX=''
#
# To always use the OpenGL libraries shipped with MATLAB uncomment the next
# line.
#
# LDPATH_PREFIX='$MATLAB/sys/opengl/lib/$ARCH'
#
LDPATH_SUFFIX=''
#
if [ "$DYLD_LIBRARY_PATH" != "" ]; then
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
else
DYLD_LIBRARY_PATH=
fi
#----------------------------------------------------------------------------
;;
*)
#----------------------------------------------------------------------------
AUTOMOUNT_MAP=''
DISPLAY="$DISPLAY"
ARCH="$ARCH"
TOOLBOX="$TOOLBOX"
MATLABPATH="$MATLABPATH"
SHELL="$SHELL"
LDPATH_PREFIX=''
#
# To always use the OpenGL libraries shipped with MATLAB uncomment the next
# line.
#
# LDPATH_PREFIX='$MATLAB/sys/opengl/lib/$ARCH'
#
LDPATH_SUFFIX=''
#
if [ "$LD_LIBRARY_PATH" != "" ]; then
LD_LIBRARY_PATH=$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=
fi
#----------------------------------------------------------------------------
;;
esac

2
README
View File

@@ -1,5 +1,3 @@
USE makefile_rel_2014_manual for release versio
## --------------------------------------------------------------------------
## makefile

Binary file not shown.

BIN
RHEL7-x86_64/2018a/mocha.mexa64 Executable file

Binary file not shown.

53
bug2020b.txt Normal file
View File

@@ -0,0 +1,53 @@
Dear Jan,
Thank you for the feedback and your suggestion to use LD_PRELOAD to load the library before we then actually LD_PRELOAD the partial glibc 2.18 implementation. Then your library should still be able to load with pure glibc 2.17 as available on your system, in which this glibc bug does not exist. I had not thought of this. I have now added this approach to our knowledge base.
Thanks again and best regards,
Martijn
--------------- Original Message ---------------
From: Martijn Aben [support@mathworks.nl]
Sent: 6/3/2021 11:56 AM
To: jan.chrin@psi.ch
Subject: Re: mex file hangs in 2020b on Linux [ ref:_00Di0Ha1u._5003q1PWEEz:ref ]
Dear Jan Chrin,
I am writing in reference to your Technical Support Case 04900956 regarding 'mex file hangs in 2020b on Linux'.
I suspect that what is going on here is that this third-party library is using pthread_join() when loaded (i.e. it might call it its entry point or the constructor of a static class instance). Using pthread_join() at library load, will lead to deadlocks in glibc versions 2.18 2.22:
https://bugzilla.redhat.com/show_bug.cgi?id=1223055
Now it looks like you are on a Red Hat 7 (based) system. RHEL 7 by default includes glibc 2.17 and so in general, outside MATLAB, you would not run into this issue with that third-party library which you work with. As a matter of fact, even inside MATLAB you will not run into any issues related to this as long as you work with a MATLAB release before R2020b; those releases will simply work with your system's glibc 2.17.
Starting with MATLAB R2020b however, MATLAB is no longer compatible with glibc 2.17, we now require 2.18 at a minimum. To still allow MATLAB to run on RHEL 7 systems, which we did still want to support, we therefore have included a partial glibc 2.18 implementation with MATLAB R20208b which is loaded on top of the glibc 2.17 of your system (if needed, if you are on a system with newer glibc we will simply only use the newer system glibc). This glibc 2.18 implementation which we add, then also actually introduces that glibc 2.18 bug.
There is no direct/straightforward solution or workaround for this issue, you have to either:
1. Avoid the usage of pthread_join() during library load. Perhaps move the initialization code which normally occurs statically/automatically at library load to a function which can/must be be called after the library has loaded. You may be able to make this change by yourself or you might need to work with the developer of the third-party library to see whether they can/are willing to make this change. The issue is not necessarily MATLAB specific; it could occur with any application trying to work with their library on a Linux distribution with glibc versions 2.18 2.22, so it could really be worth making that change. Or,
2. Work with MATLAB releases prior to R2020b, or
3. Since upgrading glibc in an existing Linux distribution is not really an option, switch to version 8 of your Red Hat (based) Linux distribution, which includes glibc 2.28 which we can work with directly and which should not suffer from that glibc bug which exists in versions 2.18 2.22. Or switch to an entirely different Linux distribution/version altogether which includes glibc > 2.22.
Please preserve the Reference ID in further correspondence on this query. This allows our systems to automatically associate your reply to the appropriate Case.
If you have a new technical support question, please submit a new request here:
http://www.mathworks.com/support/servicerequests/create.html
Sincerely,
Martijn Aben
MathWorks Technical Support Department
Self-Service: http://www.mathworks.com/support
File Exchange and MATLAB Answers: http://www.mathworks.com/matlabcentral/
The MathWorks BV
Dr. Holtroplaan 5B
5652 XR Eindhoven
The Netherlands
Chamber of Commerce Eindhoven: 29046452

268
cafe-matlab.sh Executable file
View File

@@ -0,0 +1,268 @@
#! /bin/bash
# User to set the default MATLAB version here
# This default is ONLY activated
# (1) in the absence of the relevant input argument, and
# (2) if matlab is not already pre-loaded on your system
MATLAB_DEFAULT=2017b
# cafe-matlab.sh script to enable use of the mocha mex-file
# The script executes the command: module load cafe-matlab/<matlab-version>
# which will pre-pend the $MATLABPATH environment variable with the location
# of the matching mocha mex-file
# Jan Chrin, 5 April 2017
#
# Usage: cafe-matlab.sh -v <matlab version> -d <default matlab version> -s <true/false>
# where the input key value pairs are **optional**
# Examples of usage:
# (1) Use mocha with MATLAB version 2017b but do not start matlab [-s false is default]
# cafe-matlab.sh -v 2017b
# (2) Use mocha with MATLAB version 2017b and start matlab
# cafe-matlab.sh -v 2017b -s true
# (3) Use mocha with MATLAB version given by MATLAB_DEFAULT in script
# cafe-matlab.sh -v default -s true
# cafe-matlab.sh --usedefault [equivalent -v default -s true]
# (4) Use mocha with preloaded matlab (else if none, then that given by -d option else MATLAB_DEFAULT )
# cafe-matlab.sh -d 2017b
# cafe-matlab.sh --preloaded [equivalent to -v preloaded -s true]
# If no instruction to the matlab version is given by the user then the procedure is:
# (1) If MATLAB is already loaded ($MATLAB has automatically been set),
# then the location of the corresponding mex-file will be pre-pended to $MATLABPATH
# (2) if MATLAB is **not** already loaded, then the script will use a default MATLAB
# version, as given by the -d option else that given by $MATLAB_DEFAULT in the above.
# and the location of the corresponding mex-file will be pre-pended to $MATLABPATH
PRINT_INFO=false
# Reset (required)
MATLAB_START=false
MATLAB_REQUESTED=
MATLAB_V=$MATLAB_VERSION
#For MATLAB version 2015a and earlier
if [ ! $MATLAB_VERSION ]
then
if [ ${MATLAB} ]
then
MATLAB_EXT=${MATLAB##*/}
#use IFS to split string into arrays with . being the delimeter
IFS='.' read -ra NAMES <<< $MATLAB_EXT
MATLAB_V=${NAMES[0]}
#echo $MATLAB_EXT
fi
fi
# Loop round input arguments
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-v|-V|--version|--Version)
c=$2
MATLAB_REQUESTED=${c##*/}
if [ $PRINT_INFO = true ]
then
echo MATLAB VERSION REQUESTED = "${MATLAB_REQUESTED}"
fi
shift
;;
-s|-S|--start|--Start)
MATLAB_START="$2"
if [ $PRINT_INFO = true ]
then
echo MATLAB START = "${MATLAB_START}"
fi
shift
;;
-d|-D|--default|--Default)
MATLAB_DEFAULT="$2"
if [ $PRINT_INFO = true ]
then
echo MATLAB DEFAULT = "${MATLAB_DEFAULT}"
fi
shift
;;
--preloaded)
MATLAB_REQUESTED="preloaded"
MATLAB_START=false
if [ $PRINT_INFO = true ]
then
echo MATLAB VERSION REQUESTED = "${MATLAB_REQUESTED}"
echo MATLAB START = "${MATLAB_START}"
fi
;;
--usedefault)
MATLAB_REQUESTED="default"
MATLAB_START=false
if [ $PRINT_INFO = true ]
then
echo MATLAB VERSION REQUESTED = "${MATLAB_REQUESTED}"
echo MATLAB START = "${MATLAB_START}"
fi
;;
-h|-H|--help|--Help)
echo '*********************************************************'
echo Usage: cafe-matlab.sh
echo '-v <matlabVersion> If omitted, uses pre-loaded matlab version, else default version'
echo '-d <matlabVersion> Override default version to be used if matlab module not already loaded'
echo '-s <true/false> Whether or not to start matlab; default is false.'
echo ' Option is valid for matlab versions 2020a and earlier '
echo '--show Shows matlab version currently loaded and the script default version'
echo '*********************************************************'
echo 'e.g. cafe-matlab.sh -v 2019a -s false % use matlab/2019a'
echo 'e.g. cafe-matlab.sh -d 2019a -s false % Use pre-loaded matlab module else matlab/2019a'
echo 'e.g. cafe-matlab.sh % Use pre-loaded matlab module, else that given in script'
return 2> /dev/null || exit
;;
--show)
echo '*********************************************************'
if [ $MATLAB_V ]
then
echo MATLAB VERSION CURRENTLY LOADED IS ${MATLAB_V}
else
echo 'MATLAB MODULE NOT CURRENTLY LOADED'
fi
echo THE SCRIPT DEFAULT IS $MATLAB_DEFAULT BUT WILL ONLY BE ACTIVATED IF MATLAB
echo 'IS NOT ALREADY LOADED OR OTHERWISE SPECIFIED BY THE -v OPTION'
echo '$MATLAB_DEFAULT CAN BE OVERRIDDEN USING THE -d OPTION'
echo '*********************************************************'
return 2> /dev/null || exit
;;
*)
echo Unknown input key: "$key"
echo Usage: 'cafe-matlab -v <matlab version> -s <true/false>'
echo where '-s true' will start matlab - default is false
echo Executing script with default options
# unknown option
;;
esac
shift #
done
if [ $MATLAB_REQUESTED ]
then
if [ $MATLAB_REQUESTED == 'default' ]
then
MATLAB_REQUESTED=$MATLAB_DEFAULT
fi
if [ $MATLAB_REQUESTED == 'preloaded' ]
then
MATLAB_REQUESTED= #leave empty
fi
fi
#echo $MATLAB_V
#echo $MATLAB_REQUESTED
#echo $MATLAB_DEFAULT
module use Cafe
#if -v is given then load MATLAB_REQUESTED
#if -v not given or if -v preloaded, then load MATLAB_V
#else load MATLAB_DEFAULT
if [ $MATLAB_REQUESTED ]
then
if test -f "/opt/psi/Cafe/modulefiles/cafe-matlab/${MATLAB_REQUESTED}"
then
#unload removes $MATLAB_VERSION
module unload matlab
module unload cafe-matlab
module load cafe-matlab/${MATLAB_REQUESTED}
if [ $PRINT_INFO = true ]
then
echo "Using requested version: matlab/$MATLAB_REQUESTED"
fi
else
echo "Unknown requested version: matlab/$MATLAB_REQUESTED"
echo "'module avail cafe-matlab' gives the possibilities:"
module avail cafe-matlab
MATLAB_START=false
fi
elif [ $MATLAB_V ]
then
if test -f "/opt/psi/Cafe/modulefiles/cafe-matlab/${MATLAB_V}"
then
#unload removes $MATLAB_VERSION
module unload matlab
module unload cafe-matlab
module load cafe-matlab/${MATLAB_V}
if [ $PRINT_INFO = true ]
then
echo "Using matlab/$MATLAB_V"
fi
else
module unload matlab
module unload cafe-matlab
module load cafe-matlab/$MATLAB_DEFAULT
if [ $PRINT_INFO = true ]
then
echo "Using matlab/$MATLAB_DEFAULT"
fi
fi
else
if test -f "/opt/psi/Cafe/modulefiles/cafe-matlab/${MATLAB_DEFAULT}"
then
module unload matlab
module unload cafe-matlab
module load cafe-matlab/$MATLAB_DEFAULT
if [ $PRINT_INFO = true ]
then
echo "Using matlab/$MATLAB_DEFAULT"
fi
else
echo "The default requested version: matlab/$MATLAB_DEFAULT within cafe-matlab.sh is invalid!"
echo "'module avail cafe-matlab' gives the possibilities:"
module avail cafe-matlab
fi
fi
#safe versions
mvarray=("2015a" "2016a" "2016b" "2017a" "2017b" "2018a" "2019a" "2019b" "2020a")
if [[ ! " ${mvarray[*]} " =~ " ${MATLAB_REQUESTED} " ]]; then
#echo "Version is not in array"
#ld-preload for 2020b onwards on redhat7
if [[ -z "${LD_PRELOAD}" ]]; then
export LD_PRELOAD=$EPICS/base-7.0.6/lib/$EPICS_HOST_ARCH/libCom.so
else
LD_PRELOAD_TEMP=$LD_PRELOAD
export LD_PRELOAD=$EPICS/base-7.0.6/lib/$EPICS_HOST_ARCH/libCom.so:$LD_PRELOAD
fi
MATLAB_START=true
fi
if [ $MATLAB_START = true ]
then
matlab &
fi
## Or manually acticate cafe-matlab:
## module unload matlab
## module unload cafe-matlab
## module load cafe-matlab/2016b
## or module switch cafe-matlab/2016b cafe-matlab/2015a
if [[ ! " ${mvarray[*]} " =~ " ${MATLAB_REQUESTED} " ]]; then
if [[ -z "$LD_PRELOAD_TEMP" ]]; then
unset LD_PRELOAD
else
export LD_PRELOAD=$LD_PRELOAD_TEMP
unset LD_PRELOAD_TEMP
fi
module unload cafe-matlab
module unload matlab
fi

View File

@@ -1 +0,0 @@
exampleNew.m

1068
example.m Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
makefile_rel_1.3
makefile_rel_1.13-gcc-6.3.0

View File

@@ -1,124 +0,0 @@
#
# Jan Chrin
# New Version: June 2016
#
# makefile to build mocha mex file
# printenv | grep MATLAB to reveal your MATLAB Directory
#
# e.g. on sf-lc we have
# MATLAB=/afs/psi.ch/sys/linux/opt/matlab/2015a.x86_64
#
# local executables are built in ./${EPICS_HOST_ARCH}/$(MVER)
# where the MATLAB version is grepped from $(MATLAB)
MATLAB_ROOT=${MATLAB}
MATLAB_VERSION=$(notdir $(MATLAB_ROOT))
##### CHANGE AS APPROPRIATE #################
#Mocha Version to install
MOCHA_VERSION=mocha-1.3.0-final-2
#CAFE version to link to
CAFE_VERSION=cafe-1.3.0-final-2
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_MOCHA_BASE=${CAFE_BASE}/mocha
#CAFE_CPP_BASE=/afs/psi.ch/project/cafe/gitlab/CAFE/cpp
CAFE_CPP_BASE=$(CAFE_BASE)/cpp/$(CAFE_VERSION)
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
BOOST_LIB=/afs/psi.ch/project/zeromq/devl/mate/deps/boost/lib
QT_LIB=/usr/lib64
INSTALL_MOCHA_LIBDIR= $(CAFE_MOCHA_BASE)/$(MOCHA_VERSION)/lib/$(MATLAB_VERSION)
#############################################
#First deteremine if we are on a 32/64 bit machine
#as mex file extensions are named differently
pattern64=x86_64
pattern32=i386
PWD=$(shell pwd)
#hardware platform
HW=$(shell uname -i)
ifeq ($(pattern64),$(findstring $(pattern64), $(HW)))
MEXE=mexa64
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa64
else
ifeq ($(pattern32),$(findstring $(pattern32), $(HW)))
MEXE=mexglx
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa86
endif
endif
INSTALL_PATH?=$(INSTALL_MOCHA_LIBDIR)
OBJ_DIR= ${EPICS_HOST_ARCH}/$(MATLAB_VERSION)
INCLUDEPATH_MOCHA += -I$(MATLAB_ROOT)/extern/include \
-I$(CAFE_CPP_BASE)/include -I./ \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux
INCLUDEPATH_MACHINETTA += $(INCLUDEPATH_MOCHA) -I$(BOOST_BASE) -I$(BOOST_BASE)/boost
LIB_DIR += \
-L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(MATLAB_LIB) -Wl,-rpath,$(MATLAB_LIB) \
-L$(CAFE_CPP_BASE) \
-Wl,-rpath,$(CAFE_CPP_BASE) \
-L$(QT_LIB) -Wl,-rpath,$(QT_LIB)
LIBS += -ldl -lca -lCom -lmx -lmex -lmat -lQtCore -lQtXml
LIB_INSTALL = $(LIB_DIR) -L$(INSTALL_PATH) -Wl,-rpath,$(INSTALL_PATH)
LIB_LOCAL = $(LIB_DIR)
CAFE_OBJS_DIR = $(CAFE_BASE)/cpp/$(CAFE_VERSION)/lib/libcafe.a
# MATLAB Versions 2014 onwards, use
# LDFLAGS='$(LIB_LOCAL) $(LIBS) instead of $(LIB_LOCAL) $(LIBS)
# LDFLAGS='$(LIB_LOCAL) $(LIBS) instead of $(LIB_INSTALL) $(LIBS)
$(OBJ_DIR)/mocha.$(MEXE): mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o
mex -largeArrayDims GCC='/usr/bin/gcc' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) -outdir $(OBJ_DIR) -output mocha.$(MEXE) \
$(INCLUDEPATH_MOCHA) \
LDFLAGS='$(LIB_LOCAL) $(LIBS)'
$(OBJ_DIR)/macchinettaSwitch.o: macchinettaSwitch.cpp macchinettaHelper.h \
macchinetta.h containerMochaccino.h
mex GCC='/usr/bin/g++' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
-largeArrayDims -c macchinettaSwitch.cpp $(INCLUDEPATH_MACHINETTA) -outdir $(OBJ_DIR)
install: $(OBJ_DIR)/mocha.$(MEXE)
mkdir -p $(INSTALL_PATH)
mex -largeArrayDims GCC='/usr/bin/gcc' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) -outdir $(INSTALL_PATH) -output mocha.$(MEXE) \
$(INCLUDEPATH_MOCHA) \
LDFLAGS='$(LIB_INSTALL) $(LIBS)'
cp example.m $(INSTALL_PATH)
cp scripts/*.m $(INSTALL_PATH)
cp scripts/test.xml $(INSTALL_PATH)
install_lib: $(OBJ_DIR)/libmacchinetta.so
mkdir -p $(INSTALL_PATH)
cp $(OBJ_DIR)/libmacchinetta.so $(INSTALL_PATH)
clean:
rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/*.so $(OBJ_DIR)/*.$(MEXE)

View File

@@ -1,70 +0,0 @@
MATLAB_ROOT=C:\'Program Files'\MATLAB\R2016b_x64
MEXE=mexw64
#c:\local\boost_1_62_0\
INCLUDES = -IC:\CAFE\CAFE\cpp\include -IC:\CAFE\CAFE\cpp -IC:\local\boost_1_62_0 \
-IC:\local\boost_1_62_0\boost -IC:\epics\base-3.14.12.5\include -IC:\epics\base-3.14.12.5\include\os\WIN32 \
-I"C:\Program Files\MATLAB\R2016b_x64\extern\include" \
-Ic:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include\QtCore -Ic:\Qt\qt-4.8.6-msvc2010\include\QtXml
CXX=cl
CXXFLAGS = /W4 /EHsc
OUTPUT_OPTION = /o $@
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\CAFE\CAFE\cpp\cafe.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib \
C:\Qt\Qt-4.8.6-msvc2010\lib\QtCore4.lib C:\Qt\tq-4.8.6-msvc2010\lib\QtXml4.lib
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmat.lib" \
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmex.lib" \
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmx.lib"
LIB_CAFE=C:\CAFE\CAFE\cpp\cafe.lib
LIB_BOOST =C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib
LIB_BOOST2=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-s-1_62.lib
#LIB_BOOST2=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-s-1_62.lib
#LIB_BOOST=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-1_62.lib
LIB_QT=C:\Qt\Qt-4.8.6-x64-msvc2010\lib\QtCore4.lib C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtXml4.lib
LIB_EPICS=C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib
OBJ_DIR=windows-x64
CAFE_OBJS = C:\CAFE\CAFE\cpp\src\cafeCache.obj C:\CAFE\CAFE\cpp\src\cafeGroup.obj C:\CAFE\CAFE\cpp\src\cafe.obj C:\CAFE\CAFE\cpp\src\cafeVectors.obj \
C:\CAFE\CAFE\cpp\src\cafeXML.obj C:\CAFE\CAFE\cpp\src\callbackHandlerCreate.obj C:\CAFE\CAFE\cpp\src\callbackHandlerMonitor.obj \
C:\CAFE\CAFE\cpp\src\conduitGroup.obj C:\CAFE\CAFE\cpp\src\conduit.obj \
C:\CAFE\CAFE\cpp\src\connectCallbacks.obj C:\CAFE\CAFE\cpp\src\connectGroup.obj \
C:\CAFE\CAFE\cpp\src\connect.obj C:\CAFE\CAFE\cpp\src\exceptionsHelper.obj C:\CAFE\CAFE\cpp\src\granules.obj C:\CAFE\CAFE\cpp\src\handleHelper.obj \
C:\CAFE\CAFE\cpp\src\helper.obj \
C:\CAFE\CAFE\cpp\src\loadCollectionXMLParser.obj C:\CAFE\CAFE\cpp\src\loadGroupXMLParser.obj C:\CAFE\CAFE\cpp\src\methodCallbacks.obj \
C:\CAFE\CAFE\cpp\src\policyHelper.obj \
C:\CAFE\CAFE\cpp\src\restorePVGroupXMLParser.obj C:\CAFE\CAFE\cpp\src\transpose.obj
#\NODEFAULTLIB
$(OBJ_DIR)\mocha.$(MEXE): mocha.cpp $(OBJ_DIR)\macchinettaSwitch.obj
"C:\Program Files\MATLAB\R2016b_x64\bin\win64\mex" -v COMPFLAGS="$(COMPFLAGS) -Wall" mocha.cpp $(OBJ_DIR)/macchinettaSwitch.obj -DDB_TEXT_GLBLSOURCE -DMSCC -DWIN32 -DWIN64 -largeArrayDims $(INCLUDES) $(LIB_EPICS) $(LIB_CAFE) $(LIB_BOOST) $(LIB_BOOST2) $(LIB_QT) \
-outdir $(OBJ_DIR) -output mocha.$(MEXE)
$(OBJ_DIR)\macchinettaSwitch.obj: macchinettaSwitch.cpp macchinettaHelper.h \
macchinetta.h containerMochaccino.h
"C:\Program Files\MATLAB\R2016b_x64\bin\win64\mex" -largeArrayDims \
-c macchinettaSwitch.cpp $(INCLUDES) -outdir $(OBJ_DIR)
clean:
rm -f $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.$(MEXE)

View File

@@ -1,124 +0,0 @@
#
# Jan Chrin
# New Version: June 2016
#
# makefile to build mocha mex file
# printenv | grep MATLAB to reveal your MATLAB Directory
#
# e.g. on sf-lc we have
# MATLAB=/afs/psi.ch/sys/linux/opt/matlab/2015a.x86_64
#
# local executables are built in ./${EPICS_HOST_ARCH}/$(MVER)
# where the MATLAB version is grepped from $(MATLAB)
MATLAB_ROOT=${MATLAB}
MATLAB_VERSION=$(notdir $(MATLAB_ROOT))
##### CHANGE AS APPROPRIATE #################
#Mocha Version to install
MOCHA_VERSION=mocha-1.3.0-final-1
#CAFE version to link to
CAFE_VERSION=cafe-1.3.0-final-1
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_MOCHA_BASE=${CAFE_BASE}/mocha
#CAFE_CPP_BASE=/afs/psi.ch/project/cafe/gitlab/CAFE/cpp
CAFE_CPP_BASE=$(CAFE_BASE)/cpp/$(CAFE_VERSION)
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
BOOST_LIB=/afs/psi.ch/project/zeromq/devl/mate/deps/boost/lib
QT_LIB=/usr/lib64
INSTALL_MOCHA_LIBDIR= $(CAFE_MOCHA_BASE)/$(MOCHA_VERSION)/lib/$(MATLAB_VERSION)
#############################################
#First deteremine if we are on a 32/64 bit machine
#as mex file extensions are named differently
pattern64=x86_64
pattern32=i386
PWD=$(shell pwd)
#hardware platform
HW=$(shell uname -i)
ifeq ($(pattern64),$(findstring $(pattern64), $(HW)))
MEXE=mexa64
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa64
else
ifeq ($(pattern32),$(findstring $(pattern32), $(HW)))
MEXE=mexglx
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa86
endif
endif
INSTALL_PATH?=$(INSTALL_MOCHA_LIBDIR)
OBJ_DIR= ${EPICS_HOST_ARCH}/$(MATLAB_VERSION)
INCLUDEPATH_MOCHA += -I$(MATLAB_ROOT)/extern/include \
-I$(CAFE_CPP_BASE)/include -I./ \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux
INCLUDEPATH_MACHINETTA += $(INCLUDEPATH_MOCHA) -I$(BOOST_BASE) -I$(BOOST_BASE)/boost
LIB_DIR += \
-L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(MATLAB_LIB) -Wl,-rpath,$(MATLAB_LIB) \
-L$(CAFE_CPP_BASE) \
-Wl,-rpath,$(CAFE_CPP_BASE) \
-L$(QT_LIB) -Wl,-rpath,$(QT_LIB)
LIBS += -ldl -lca -lCom -lmx -lmex -lmat -lQtCore -lQtXml
LIB_INSTALL = $(LIB_DIR) -L$(INSTALL_PATH) -Wl,-rpath,$(INSTALL_PATH)
LIB_LOCAL = $(LIB_DIR)
CAFE_OBJS_DIR = $(CAFE_BASE)/cpp/$(CAFE_VERSION)/lib/libcafe.a
# MATLAB Versions 2014 onwards, use
# LDFLAGS='$(LIB_LOCAL) $(LIBS) instead of $(LIB_LOCAL) $(LIBS)
# LDFLAGS='$(LIB_LOCAL) $(LIBS) instead of $(LIB_INSTALL) $(LIBS)
$(OBJ_DIR)/mocha.$(MEXE): mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o
mex -largeArrayDims GCC='/usr/bin/gcc' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) -outdir $(OBJ_DIR) -output mocha.$(MEXE) \
$(INCLUDEPATH_MOCHA) \
LDFLAGS='$(LIB_LOCAL) $(LIBS)'
$(OBJ_DIR)/macchinettaSwitch.o: macchinettaSwitch.cpp macchinettaHelper.h \
macchinetta.h containerMochaccino.h
mex GCC='/usr/bin/g++' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
-largeArrayDims -c macchinettaSwitch.cpp $(INCLUDEPATH_MACHINETTA) -outdir $(OBJ_DIR)
install: $(OBJ_DIR)/mocha.$(MEXE)
mkdir -p $(INSTALL_PATH)
mex -largeArrayDims GCC='/usr/bin/gcc' CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) -outdir $(INSTALL_PATH) -output mocha.$(MEXE) \
$(INCLUDEPATH_MOCHA) \
LDFLAGS='$(LIB_INSTALL) $(LIBS)'
cp example.m $(INSTALL_PATH)
cp scripts/*.m $(INSTALL_PATH)
cp scripts/test.xml $(INSTALL_PATH)
install_lib: $(OBJ_DIR)/libmacchinetta.so
mkdir -p $(INSTALL_PATH)
cp $(OBJ_DIR)/libmacchinetta.so $(INSTALL_PATH)
clean:
rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/*.so $(OBJ_DIR)/*.$(MEXE)

View File

@@ -1,70 +0,0 @@
MATLAB_ROOT=C:\'Program Files'\MATLAB\R2016b_x64
MEXE=mexw64
#c:\local\boost_1_62_0\
INCLUDES = -IC:\CAFE\CAFE\cpp\include -IC:\CAFE\CAFE\cpp -IC:\local\boost_1_62_0 \
-IC:\local\boost_1_62_0\boost -IC:\epics\base-3.14.12.5\include -IC:\epics\base-3.14.12.5\include\os\WIN32 \
-I"C:\Program Files\MATLAB\R2016b_x64\extern\include" \
-Ic:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include\QtCore -Ic:\Qt\qt-4.8.6-msvc2010\include\QtXml
CXX=cl
CXXFLAGS = /W4 /EHsc
OUTPUT_OPTION = /o $@
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\CAFE\CAFE\cpp\cafe.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib \
C:\Qt\Qt-4.8.6-msvc2010\lib\QtCore4.lib C:\Qt\tq-4.8.6-msvc2010\lib\QtXml4.lib
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmat.lib" \
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmex.lib" \
#"C:\Program Files\MATLAB\R2016b_x64\extern\lib\win64\microsoft\libmx.lib"
LIB_CAFE=C:\CAFE\CAFE\cpp\cafe.lib
LIB_BOOST =C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib
LIB_BOOST2=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-s-1_62.lib
#LIB_BOOST2=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-s-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-s-1_62.lib
#LIB_BOOST=C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-1_62.lib \
#C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-1_62.lib
LIB_QT=C:\Qt\Qt-4.8.6-x64-msvc2010\lib\QtCore4.lib C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtXml4.lib
LIB_EPICS=C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib
OBJ_DIR=windows-x64
CAFE_OBJS = C:\CAFE\CAFE\cpp\src\cafeCache.obj C:\CAFE\CAFE\cpp\src\cafeGroup.obj C:\CAFE\CAFE\cpp\src\cafe.obj C:\CAFE\CAFE\cpp\src\cafeVectors.obj \
C:\CAFE\CAFE\cpp\src\cafeXML.obj C:\CAFE\CAFE\cpp\src\callbackHandlerCreate.obj C:\CAFE\CAFE\cpp\src\callbackHandlerMonitor.obj \
C:\CAFE\CAFE\cpp\src\conduitGroup.obj C:\CAFE\CAFE\cpp\src\conduit.obj \
C:\CAFE\CAFE\cpp\src\connectCallbacks.obj C:\CAFE\CAFE\cpp\src\connectGroup.obj \
C:\CAFE\CAFE\cpp\src\connect.obj C:\CAFE\CAFE\cpp\src\exceptionsHelper.obj C:\CAFE\CAFE\cpp\src\granules.obj C:\CAFE\CAFE\cpp\src\handleHelper.obj \
C:\CAFE\CAFE\cpp\src\helper.obj \
C:\CAFE\CAFE\cpp\src\loadCollectionXMLParser.obj C:\CAFE\CAFE\cpp\src\loadGroupXMLParser.obj C:\CAFE\CAFE\cpp\src\methodCallbacks.obj \
C:\CAFE\CAFE\cpp\src\policyHelper.obj \
C:\CAFE\CAFE\cpp\src\restorePVGroupXMLParser.obj C:\CAFE\CAFE\cpp\src\transpose.obj
#\NODEFAULTLIB
$(OBJ_DIR)\mocha.$(MEXE): mocha.cpp $(OBJ_DIR)\macchinettaSwitch.obj
"C:\Program Files\MATLAB\R2016b_x64\bin\win64\mex" -v COMPFLAGS="$(COMPFLAGS) -Wall" mocha.cpp $(OBJ_DIR)/macchinettaSwitch.obj -DDB_TEXT_GLBLSOURCE -DMSCC -DWIN32 -DWIN64 -largeArrayDims $(INCLUDES) $(LIB_EPICS) $(LIB_CAFE) $(LIB_BOOST) $(LIB_BOOST2) $(LIB_QT) \
-outdir $(OBJ_DIR) -output mocha.$(MEXE)
$(OBJ_DIR)\macchinettaSwitch.obj: macchinettaSwitch.cpp macchinettaHelper.h \
macchinetta.h containerMochaccino.h
"C:\Program Files\MATLAB\R2016b_x64\bin\win64\mex" -largeArrayDims \
-c macchinettaSwitch.cpp $(INCLUDES) -outdir $(OBJ_DIR)
clean:
rm -f $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.$(MEXE)

View File

@@ -1,2 +0,0 @@
/opt/psi/Cafe/cafe-matlab.sh -v 2015a
matlab &

99
msg.txt Normal file
View File

@@ -0,0 +1,99 @@
Re: cafe-matlab version 2020b and onwards.
Important information to cafe-matlab users.
Dear Colleagues,
Starting with MATLAB 2020b, the mocha mex-file
will only work if matlab is executed from the
following bash script:
source /opt/psi/Cafe/cafe-matlab.sh -v 2020b
This script by necessity momentarily adds the
EPICS libCom.so library to the LD_PRELOAD environment
variable before starting matlab. The library is
immediately removed from LD_PRELOAD once matlab is
executed. The setting of LD_PRELOAD was previously
handled from within the IT load module step but has
now been withdraw from this procedure and delegated
to the above script to prevent conflict with other
epics client applications running on the user's console
that would unwittingly pick up this lingering environment
variable.
An explanation as to why this is required is given below.
For those invoking the above script in their .bashrc
in order to load the cafe-matlab module for later use;
the script can continue to be used for this purpose for
matlab versions 2020a and earlier only:
source /opt/psi/Cafe/cafe-matlab.sh -v 2020a
The above script can also be used to both load the
cafe-matlab module and start matlab, e.g, on the
command line, for all matlab versions (old and new)
as follows:
source /opt/psi/Cafe/cafe-matlab.sh -v 2020a -s True
The -s flag controls whether or not to start matlab
and only plays a role only for matlab 2020a or earlier.
The default value is False (and thus matlab is started
explicitly by the user). For matlab 2020b onwards
the flag is always set to True. To learn of all script
options, see:
/opt/psi/Cafe/cafe-matlab.sh -h
FYI, the mocha mex-file for MATLAB version 2020a and
onwards uses the latest epics 7 client release:
mocha('epicsversion')
Please let me know if I can assist with anything.
Yours,
Jan
http://cafe.psi.ch/mocha.html
What's going on?
================
With input from a reply from Mathworks Technical Support.
MATLAB 2020b and subsequent versions require glibc
version 2.18 or greater. Red Hat 7 (RHEL7), however,
is based on the glib 2.17 release.
To allow MATLAB 2020b to run on RHEL7, MATLAB includes
a partial glib 2.18 implementation that is pre-loaded
atop of RHEL7's glibc 2.17. Unfortunately, there is
a documented bug in glib versions 2.18 - 2.22 that
results in a deadlock in libraries using pthread_join
when loaded. Since EPICS libCom library relies on this
method, any epics client mex-file will hang and freeze
matlab. The problem can be circumvented by specifically
pre-loading the EPICS libCom library before the partial
glibc 2.18 preload. In this way, libCom is loaded with
glibc 2.17 (which does not have this glibc bug.)
To PyCafe users.
Dear Colleagues,
FYI, updated PyCafe extensions for python 3.5, 3.7, and 3.8
have been provided using the latest epics7 client library.
If it is of interest to stay "au courant", please add the
following to your PYTHONPATH:
/opt/gfa/cafe/python/pycafe/cafe-1.15.0/lib/RHEL7-x86_64
The epics version can be retrieved with the following cafe method:
cafe.epics_version_string()
Please let me if you would like more information or help with anything.
Yours,
Jan
http://cafe.psi.ch/cython.html

3
out Normal file
View File

@@ -0,0 +1,3 @@
mex CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++1z' \
-c macchinettaSwitch.cpp -I/opt/psi/Programming/matlab/2021b/extern/include -I/opt/gfa/cafe/cpp/cafe-1.15.0-gcc-7.3.0/include -I./ -I/usr/local/epics/base-7.0.6/include -I/usr/local/epics/base-7.0.6/include/os/Linux -I/usr/local/epics/base-7.0.6/include/compiler/gcc -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -outdir RHEL7-x86_64/2021b
Building with 'g++'.

View File

@@ -1,109 +0,0 @@
function value = caget(channel,cached)
% caget('channel') returns current value and additional infos
% of given EPICS channel.
% caget('channel',1) returns last value and additional infos
% of given EPICS channel.
%
% channel can be a channel name or a handle as returned from mcaopen
%
% return value elements:
% val: value (scalar, vector or string)
% sevr: severity as a number
% sevr_str: severity as a string
% stat: status as a number
% stat_str: status as a string
% time: timestamp as a date vector
% units: units string
persistent severity_str
persistent status_str
persistent zerotime
persistent units
if ischar(channel)
pv = mocha('open',channel);
if mocha('isConnected', channel) == false
mocha('openNowAndWait', 0.5)
end
if mocha('isConnected', channel) == false
error('EPICS channel %s not found', channel);
end
elseif isnumeric(channel)
pv = channel;
else
error ('first argument must be channel name or handle');
end
if isvector(pv)
pv=pv(1); % truncate
end
if nargin > 1 && cached
pvStruct = mocha('getPVCache',pv);
else
pvStruct = mocha('getPV', pv);
end
val=pvStruct.val
pvCtrl = mocha('getCtrlCache',pv);
%pvCtrl
% initialize severity and status enums
if isempty(severity_str)
severity_str = {'NO_ALARM';'MINOR';'MAJOR';'INVALID'};
status_str = {'NO_ALARM';'READ';'WRITE';'HIHI';'HIGH';'LOLO';'LOW';'STATE';'COS';'COMM';'TIMEOUT';'HWLIMIT';'CALC';'SCAN';'LINK';'SOFT';'BAD_SUB';'UDF';'DISABLE';'SIMM';'READ_ACCESS';'WRITE_ACCESS'};
end
value.val = val;
units = pvCtrl.units;
string = pvCtrl.enumStrings;
if size(string) > 1
disp(size(string))
value.val_str = value.val;
value.val = mocha('getCache',pv,'int8');
end
%if ~isempty(units{1})
%value.units = units{1};
%end
value.units=units;
value.sevr = pvStruct.alarmSeverity;
indx=max(pvStruct.alarmSeverity, 0);
value.sevr_str = severity_str{indx+1};
value.stat = pvStruct.alarmStatus;
indx=max(pvStruct.alarmStatus, 0);
value.stat_str = status_str{ indx+1};
timestamp = mocha('getTimestamp',pv);
if (numel(timestamp) == 2)
% old mca version
% do not use mcatime here because 1. it is slow, 2. is returns UTC
% calculating zerotime only once is faster and takes localtime into account
% When daylight saving time begins or ends, restart the program!
if isempty(zerotime)
[status,timezone]=system('date +%z'); % get localtime offset
timeoffs=str2double(timezone);
houroffs=floor(timeoffs/100);
minoffs=(timeoffs-100*houroffs);
zerotime = datenum('1-Jan-1990') + (minoffs/60 + houroffs)/24;
end
time=timestamp(1)+timestamp(2)/1000000000;
if time
time = zerotime+time/24/3600;
end
value.time = datevec(time);
else
% new mca version
timestamp(6)=timestamp(6)+timestamp(7)/1000000000;
value.time = timestamp(1:6);
end

View File

@@ -23,16 +23,20 @@ dstruct = mocha('getPVCache', hpv);
t=struct2table(dstruct);
for n=1:length(hpv)
s1(n).handle=hpv(n);
s1(n).handle=hpv(n);
s1(n).pv=pvn(n);
s1(n).cs=state(n);
s1(n).nmon=mocha('getNoMonitors', hpv(n));
end
t1=struct2table(s1);
if (string(class(t.val)) == string('char'))
t.val=string(t.val);
end
pvt=table(t1.handle,t1.pv,t.val, t.status, t1.cs);
pvt.Properties.VariableNames={'h','pv', 'val', 'stat','c'};
pvt=table(t1.handle,t1.pv, t.val, t.status, t1.cs, t1.nmon);
pvt.Properties.VariableNames={'h','pv', 'val', 'stat','c', 'm'};
%tNew.Properties.VariableNames{'Var1'}= 'handle';
%tNew.Properties.VariableNames{'Var2'}= 'pv';
%tNew.Properties.VariableNames{'Var3'}= 'val';