From 8c06009feb8930555086df786f44aecc3281d9e4 Mon Sep 17 00:00:00 2001 From: Tom Gade Date: Thu, 30 Nov 2023 11:39:26 -0600 Subject: [PATCH 1/2] 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 --- bindings/C/adios2/c/adios2_c_adios.h | 2 +- bindings/Matlab/Makefile | 10 ++++++++++ bindings/Matlab/adiosopenc.c | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bindings/C/adios2/c/adios2_c_adios.h b/bindings/C/adios2/c/adios2_c_adios.h index b5044b0447..147cb8ab6a 100644 --- a/bindings/C/adios2/c/adios2_c_adios.h +++ b/bindings/C/adios2/c/adios2_c_adios.h @@ -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 /** diff --git a/bindings/Matlab/Makefile b/bindings/Matlab/Makefile index 09978c32b8..aaaebf3a0e 100644 --- a/bindings/Matlab/Makefile +++ b/bindings/Matlab/Makefile @@ -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: diff --git a/bindings/Matlab/adiosopenc.c b/bindings/Matlab/adiosopenc.c index 95dc6d41b3..c3b6db7370 100644 --- a/bindings/Matlab/adiosopenc.c +++ b/bindings/Matlab/adiosopenc.c @@ -140,7 +140,11 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) /********************************************************/ /* Open ADIOS file now and get variables and attributes */ +#if ADIOS2_USE_MPI adiosobj = adios2_init(false); +#else + adiosobj = adios2_init(); +#endif group = adios2_declare_io(adiosobj, "matlabiogroup"); // name is arbitrary fp = adios2_open(group, fname, adios2_mode_read); if (fp == NULL) From e9b7c0caa74664ffd9e1b5b4446f9b20f39b2b93 Mon Sep 17 00:00:00 2001 From: Tom Gade Date: Fri, 1 Dec 2023 09:28:56 -0600 Subject: [PATCH 2/2] Update adiosopenc.c to use adios2_init_serial regardless of MPI use. --- bindings/Matlab/adiosopenc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bindings/Matlab/adiosopenc.c b/bindings/Matlab/adiosopenc.c index c3b6db7370..b9b4c1a88a 100644 --- a/bindings/Matlab/adiosopenc.c +++ b/bindings/Matlab/adiosopenc.c @@ -140,11 +140,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) /********************************************************/ /* Open ADIOS file now and get variables and attributes */ -#if ADIOS2_USE_MPI - adiosobj = adios2_init(false); -#else - adiosobj = adios2_init(); -#endif + adiosobj = adios2_init_serial(); group = adios2_declare_io(adiosobj, "matlabiogroup"); // name is arbitrary fp = adios2_open(group, fname, adios2_mode_read); if (fp == NULL)