Skip to content

Commit

Permalink
Fix MATLAB bindings for MacOS (#3950)
Browse files Browse the repository at this point in the history
* Fix MATLAB bindings for MacOS - updated bindings/Matlab/Makefile, added preprocessor macro to check MPI usage and call the correct version of adios2_init() accordingly, fixed spelling error in bindings/C/adios2/c/adios2_c_adios.h

* Update adiosopenc.c to use adios2_init_serial regardless of MPI use.
  • Loading branch information
tomgade09 committed Dec 1, 2023
1 parent ee2db16 commit 5ec9ef9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bindings/C/adios2/c/adios2_c_adios.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ adios2_adios *adios2_init_config_mpi(const char *config_file, MPI_Comm comm);

#else
#define adios2_init() adios2_init_serial()
#define adios2_init_config(config_file) adios2_init_config_seria(config_file)
#define adios2_init_config(config_file) adios2_init_config_serial(config_file)
#endif

/**
Expand Down
10 changes: 10 additions & 0 deletions bindings/Matlab/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ MEXLIBS="LDFLAGS=${ADIOS_LIBS}"
ADIOS_INC=-I${ADIOS_DIR}/include
ADIOS_LIBS=`${ADIOS_DIR}/bin/adios2-config --c-libs`

### MacOS - example using homebrew installed ADIOS2 and Xcode 15 clang
### 1) Install homebrew (https://brew.sh/) and Xcode (App Store)
### 2) brew install adios2
### OR
### 2) Compile Adios2 from scratch and update ADIOS_DIR below to match install directory
#ADIOS_DIR=/opt/homebrew/opt/adios2
#ADIOS_INC=-I${ADIOS_DIR}/include
#ADIOS_LIBS=-Wl,-rpath,${ADIOS_DIR}/lib -shared -L${ADIOS_DIR}/lib -ladios2_c -ladios2_core
#MEXLIBS="LDFLAGS=${ADIOS_LIBS}"


MEXOPTS=-largeArrayDims -DDEBUG CFLAGS="-g -std=c99 -fPIC -O0"
default:
Expand Down
2 changes: 1 addition & 1 deletion bindings/Matlab/adiosopenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

/********************************************************/
/* Open ADIOS file now and get variables and attributes */
adiosobj = adios2_init(false);
adiosobj = adios2_init_serial();
group = adios2_declare_io(adiosobj, "matlabiogroup"); // name is arbitrary
fp = adios2_open(group, fname, adios2_mode_read);
if (fp == NULL)
Expand Down

0 comments on commit 5ec9ef9

Please sign in to comment.