diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd4c5e390..e0f03883f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,12 @@ stages: perlmutter-no-cache-build: stage: build - when: manual + rules: + - if: '$METRICS == null' + when: manual + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ allow_failure: false tags: - perlmutter @@ -32,7 +37,12 @@ perlmutter-no-cache-build: perlmutter-cache-build: stage: build - when: manual + rules: + - if: '$METRICS == null' + when: manual + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ allow_failure: false tags: - perlmutter @@ -60,6 +70,9 @@ perlmutter-cache-build: perlmutter-no-cache-parallel-pdc: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -80,6 +93,9 @@ perlmutter-no-cache-parallel-pdc: perlmutter-no-cache-parallel-obj: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -101,6 +117,9 @@ perlmutter-no-cache-parallel-obj: perlmutter-no-cache-parallel-cont: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -122,6 +141,9 @@ perlmutter-no-cache-parallel-cont: perlmutter-no-cache-parallel-prop: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -143,6 +165,9 @@ perlmutter-no-cache-parallel-prop: perlmutter-no-cache-parallel-region: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -164,6 +189,9 @@ perlmutter-no-cache-parallel-region: perlmutter-no-cache-parallel-region-all: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -190,6 +218,9 @@ perlmutter-no-cache-parallel-region-all: perlmutter-cache-parallel-pdc: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -210,6 +241,9 @@ perlmutter-cache-parallel-pdc: perlmutter-cache-parallel-obj: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -231,6 +265,9 @@ perlmutter-cache-parallel-obj: perlmutter-cache-parallel-cont: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -252,6 +289,9 @@ perlmutter-cache-parallel-cont: perlmutter-cache-parallel-prop: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -273,6 +313,9 @@ perlmutter-cache-parallel-prop: perlmutter-cache-parallel-region: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -294,6 +337,9 @@ perlmutter-cache-parallel-region: perlmutter-cache-parallel-region-all: stage: test + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == null' needs: @@ -313,26 +359,54 @@ perlmutter-cache-parallel-region-all: - ctest -L parallel_region_transfer_all - rm -rf ${PDC_TMPDIR} ${PDC_DATA_LOC} +perlmutter-metrics-build: + stage: build + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ + rules: + - if: '$METRICS == "true"' + allow_failure: false + tags: + - perlmutter + variables: + SCHEDULER_PARAMETERS: "-A m2621 --qos=debug --constraint=cpu --tasks-per-node=64 -N 1 -t 00:30:00" + SUPERCOMPUTER: "perlmutter" + MERCURY_DIR: "/global/cfs/cdirs/m2621/pdc-perlmutter/mercury/install" + script: + - module load libfabric/1.15.2.0 + - module list + - mkdir -p ${PDC_BUILD_PATH}/perlmutter/metrics + - cd ${PDC_BUILD_PATH}/perlmutter/metrics + - cmake ../../.. -DBUILD_MPI_TESTING=ON -DBUILD_SHARED_LIBS=ON -DPDC_SERVER_CACHE=ON -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX=$PDC_DIR -DPDC_ENABLE_MPI=ON -DMERCURY_DIR=$MERCURY_DIR -DCMAKE_C_COMPILER=cc -DMPI_RUN_CMD="srun -A m2621 --qos=debug --constraint=cpu --tasks-per-node=64" -DCMAKE_INSTALL_PREFIX=${PDC_INSTALL_PATH}/perlmutter/metrics + - make -j + - make install + artifacts: + paths: + - ${PDC_BUILD_PATH}/perlmutter/metrics + - ${PDC_INSTALL_PATH}/perlmutter/metrics + perlmutter-metrics: stage: metrics + id_tokens: + SITE_ID_TOKEN: + aud: https://software.nersc.gov/ rules: - if: '$METRICS == "true"' needs: - - perlmutter-cache-build + - perlmutter-metrics-build tags: - perlmutter variables: - PDC_N_NODES: 64 - PDC_N_CLIENTS: 127 - SCHEDULER_PARAMETERS: "-A m2621 --qos=regular --constraint=cpu --tasks-per-node=${PDC_N_CLIENTS} -N ${PDC_N_NODES} -t 00:30:00" + SCHEDULER_PARAMETERS: "-A m2621 --qos=${PDC_QUEUE} --constraint=cpu --tasks-per-node=${PDC_N_CLIENTS} -N ${PDC_N_NODES} -t 00:30:00" SUPERCOMPUTER: "perlmutter" MERCURY_DIR: "/global/cfs/cdirs/m2621/pdc-perlmutter/mercury/install" PDC_TMPDIR: "${PDC_BUILD_PATH}/pdc-tmp-metrics" PDC_DATA_LOC: "${PDC_BUILD_PATH}/pdc-data-metrics" PDC_CLIENT_LOOKUP: "NONE" - PDC_SERVER: "${PDC_BUILD_PATH}/perlmutter/cache/bin/pdc_server.exe" - PDC_SERVER_CLOSE: "${PDC_BUILD_PATH}/perlmutter/cache/bin/close_server" - PDC_CLIENT: "${PDC_BUILD_PATH}/perlmutter/cache/bin/vpicio_mts" + PDC_SERVER: "${PDC_BUILD_PATH}/perlmutter/metrics/bin/pdc_server.exe" + PDC_SERVER_CLOSE: "${PDC_BUILD_PATH}/perlmutter/metrics/bin/close_server" + PDC_CLIENT: "${PDC_BUILD_PATH}/perlmutter/metrics/bin/vpicio_mts" PDC_JOB_OUTPUT: "pdc-metrics.log" script: - hostname diff --git a/CMakeLists.txt b/CMakeLists.txt index 70bc8ce2e..a3abd14bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,7 +380,7 @@ endif() #----------------------------------------------------------------------------- # SERVER CACHE option #----------------------------------------------------------------------------- -option(PDC_SERVER_CACHE "Enable Server Caching." OFF) +option(PDC_SERVER_CACHE "Enable Server Caching." ON) if(PDC_SERVER_CACHE) set(PDC_SERVER_CACHE 1) set(PDC_SERVER_CACHE_MAX_GB "3" CACHE STRING "Max GB for server cache") diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 295517128..b2a767725 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -125,11 +125,8 @@ Install libfabric .. attention:: - If you're installing PDC on MacOS, you need to make sure you enable ``sockets``: - - .. code-block: Bash - - ./configure CFLAG=-O2 --enable-sockets=yes --enable-tcp=yes --enable-udp=yes --enable-rxm=yes + When installing on MacOS, make sure to enable ``sockets`` with the following configure command: + ``./configure CFLAG=-O2 --enable-sockets=yes --enable-tcp=yes --enable-udp=yes --enable-rxm=yes`` Install Mercury @@ -156,17 +153,13 @@ Install Mercury echo 'export PATH=$MERCURY_DIR/include:$MERCURY_DIR/lib:$PATH' >> $WORK_SPACE/pdc_env.sh .. note:: + ``CC=mpicc`` may need to be changed to the corresponding compiler in your system, e.g. ``-DCMAKE_C_COMPILER=cc`` or ``-DCMAKE_C_COMPILER=gcc``. Make sure the ctest passes. PDC may not work without passing all the tests of Mercury. .. attention:: - If you're installing PDC on MacOS, for the tests to work you need to specify the protocol used by Mercury: - - .. code-block: Bash - - cmake -DCMAKE_INSTALL_PREFIX=$MERCURY_DIR -DCMAKE_C_COMPILER=mpicc -DBUILD_SHARED_LIBS=ON \ - -DBUILD_TESTING=ON -DNA_USE_OFI=ON -DNA_USE_SM=OFF -DNA_OFI_TESTING_PROTOCOL=sockets + When installing on MacOS, specify the ``sockets`` protocol used by Mercury by replacing the cmake command from ``-DNA_OFI_TESTING_PROTOCOL=tcp`` to ``-DNA_OFI_TESTING_PROTOCOL=sockets`` Install PDC @@ -197,11 +190,7 @@ Install PDC If you are trying to compile PDC on MacOS, ``LibUUID`` needs to be installed on your MacOS first. Simple use ``brew install ossp-uuid`` to install it. If you are trying to compile PDC on Linux, you should also make sure ``LibUUID`` is installed on your system. If not, you can install it with ``sudo apt-get install uuid-dev`` on Ubuntu or ``yum install libuuid-devel`` on CentOS. - In MacOS you also need to export the following environment variable so PDC (i.e., Mercury) uses the ``socket`` protocol, the only one supported in MacOS: - - .. code-block: Bash - - export HG_TRANSPORT="sockets" + In MacOS you also need to export the following environment variable so PDC (i.e., Mercury) uses the ``socket`` protocol, the only one supported in MacOS: ``export HG_TRANSPORT="sockets"`` Test Your PDC Installation @@ -219,6 +208,7 @@ You can also specify a timeout (e.g., 2 minutes) for the tests by specifying the ctest --timeout 120 .. note:: + If you are using PDC on an HPC system, e.g. Perlmutter@NERSC, ``ctest`` should be run on a compute node, you can submit an interactive job on Perlmutter: ``salloc --nodes 1 --qos interactive --time 01:00:00 --constraint cpu --account=mxxxx`` @@ -232,23 +222,21 @@ But before adding any of your function, we need to enable the Julia support firs Prerequisite ^^^^^^^^^^^^ -Make sure you have Julia-lang installed. You can check with your system administrator to see if you already have Julia-lang installed. If not, you can either ask your system administrator to install it for you or you can install it yourself if permitted. On macOS, the best way to install Julia is via `Homebrew https://brew.sh`_. You may also refer to `Julia Download Page https://julialang.org/downloads/`_ for instructions on installing Julia. -Once you installed Julia, you can set `JULIA_HOME` to be where Julia-lang is installed. +Make sure you have Julia-lang installed. You can check with your system administrator to see if you already have Julia-lang installed. If not, you can either ask your system administrator to install it for you or you can install it yourself if permitted. On macOS, the best way to install Julia is via `Homebrew `_. You may also refer to `Julia Download Page `_ for instructions on installing Julia. +Once you installed Julia, you can set ``JULIA_HOME`` to be where Julia-lang is installed. .. code-block:: Bash - export JULIA_HOME=/path/to/julia/install/directory + export JULIA_HOME=/path/to/julia/install/directory -.. note:: Note on perlmutter: - You can easily perform `module load julia` to load the Julia-lang environment. Then, you can do the following to set `$JULIA_HOME`: +.. note:: - .. code-block:: Bash - export JULIA_HOME=$(dirname $(dirname $(which julia))) + On Perlmutter You can ``module load julia`` to load the Julia-lang module and set ``$JULIA_HOME`` with: ``export JULIA_HOME=$(dirname $(dirname $(which julia)))`` Enabling Julia Support for PDC Tests ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Once the Prerequisite is satisfied, you can enable Julia support by adding `--DPDC_ENABLE_JULIA_SUPPORT=ON` to your cmake command and re-run it. +Once the Prerequisite is satisfied, you can enable Julia support by adding ``--DPDC_ENABLE_JULIA_SUPPORT=ON`` to your cmake command and re-run it. Then you can compile your PDC project with Julia support. Now, see Developer Notes to know how you can add your own Julia functions to enhance your test cases in PDC. @@ -257,9 +245,10 @@ Now, see Developer Notes to know how you can add your own Julia functions to enh Build PDC in a Docker Container --------------------------------------------------- Simply run the following command from the project root directory to build PDC in a Docker container: + .. code-block:: Bash - .docker/run_dev_base.sh + .docker/run_dev_base.sh Build PDC in Github Codespace --------------------------------------------------- diff --git a/examples/Makefile b/examples/Makefile index 4dcbb0acf..e0ccbc987 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -4,7 +4,7 @@ CFLAGS = -O2 -Wall -Wextra INCLUDES = -I. -I$(PDC_DIR)/include LDFLAGS = -Wl,-rpath,$(PDC_DIR)/lib -L$(PDC_DIR)/lib -LIBS = -lpdc +LIBS = -lpdc -lpdc_commons .c.o: $(CC) $(CFLAGS) $(INCLUDES) -c $< diff --git a/examples/bdcats.c b/examples/bdcats.c index 13c052b24..b9c3102cb 100644 --- a/examples/bdcats.c +++ b/examples/bdcats.c @@ -101,43 +101,75 @@ main(int argc, char **argv) if (cont_id == 0) printf("Fail to create container @ line %d!\n", __LINE__); - // open objects - obj_xx = PDCobj_open("obj-var-xx", pdc_id); + // open objects +#ifdef ENABLE_MPI + obj_xx = PDCobj_open_col("obj-var-xx", pdc_id); +#else + obj_xx = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_xx == 0) { printf("Error when open object %s\n", "obj-var-xx"); exit(-1); } - obj_yy = PDCobj_open("obj-var-yy", pdc_id); +#ifdef ENABLE_MPI + obj_yy = PDCobj_open_col("obj-var-yy", pdc_id); +#else + obj_yy = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_yy == 0) { printf("Error when open object %s\n", "obj-var-yy"); exit(-1); } - obj_zz = PDCobj_open("obj-var-zz", pdc_id); +#ifdef ENABLE_MPI + obj_zz = PDCobj_open_col("obj-var-zz", pdc_id); +#else + obj_zz = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_zz == 0) { printf("Error when open object %s\n", "obj-var-zz"); exit(-1); } - obj_pxx = PDCobj_open("obj-var-pxx", pdc_id); +#ifdef ENABLE_MPI + obj_pxx = PDCobj_open_col("obj-var-pxx", pdc_id); +#else + obj_pxx = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_pxx == 0) { printf("Error when open object %s\n", "obj-var-pxx"); exit(-1); } - obj_pyy = PDCobj_open("obj-var-pyy", pdc_id); +#ifdef ENABLE_MPI + obj_pyy = PDCobj_open_col("obj-var-pyy", pdc_id); +#else + obj_pyy = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_pyy == 0) { printf("Error when open object %s\n", "obj-var-pyy"); exit(-1); } - obj_pzz = PDCobj_open("obj-var-pzz", pdc_id); +#ifdef ENABLE_MPI + obj_pzz = PDCobj_open_col("obj-var-pzz", pdc_id); +#else + obj_pzz = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_pzz == 0) { printf("Error when open object %s\n", "obj-var-pzz"); exit(-1); } - obj_id11 = PDCobj_open("id11", pdc_id); +#ifdef ENABLE_MPI + obj_id11 = PDCobj_open_col("id11", pdc_id); +#else + obj_id11 = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_id11 == 0) { printf("Error when open object %s\n", "id11"); exit(-1); } - obj_id22 = PDCobj_open("id22", pdc_id); +#ifdef ENABLE_MPI + obj_id22 = PDCobj_open_col("id22", pdc_id); +#else + obj_id22 = PDCobj_open("obj-var-xx", pdc_id); +#endif if (obj_id22 == 0) { printf("Error when open object %s\n", "id22"); exit(-1); diff --git a/examples/bdcats_batch.c b/examples/bdcats_batch.c index 2bfb07f05..fab0f507a 100644 --- a/examples/bdcats_batch.c +++ b/examples/bdcats_batch.c @@ -45,7 +45,8 @@ uniform_random_number() void print_usage() { - printf("Usage: srun -n ./vpicio sleep_time timestamps #particles\n"); + printf("Usage: srun -n bdcats_batch sleep_time timestep #particles test_method(0:old API, 1:wait, " + "default 2:wait all)\n"); } int @@ -81,7 +82,7 @@ main(int argc, char **argv) *transfer_request_py, *transfer_request_pz, *transfer_request_id1, *transfer_request_id2, *ptr, *temp_requests; - uint64_t timestamps = 10; + uint64_t timestep = 10; double start, end, transfer_start = .0, transfer_wait = .0, transfer_create = .0, transfer_close = .0, max_time, min_time, avg_time, total_time, start_total_time; @@ -99,7 +100,7 @@ main(int argc, char **argv) sleep_time = (unsigned)atoi(argv[1]); } if (argc >= 3) { - timestamps = atoll(argv[2]); + timestep = atoll(argv[2]); } if (argc >= 4) { numparticles = atoll(argv[3]); @@ -110,8 +111,8 @@ main(int argc, char **argv) test_method = atoi(argv[4]); } if (!rank) { - printf("sleep time = %u, timestamps = %" PRIu64 ", numparticles = %" PRIu64 ", test_method = %d\n", - sleep_time, timestamps, numparticles, test_method); + printf("sleep time = %u, timestep = %" PRIu64 ", numparticles = %" PRIu64 ", test_method = %d\n", + sleep_time, timestep, numparticles, test_method); } x = (float *)malloc(numparticles * sizeof(float)); @@ -128,14 +129,14 @@ main(int argc, char **argv) // create a pdc pdc_id = PDCinit("pdc"); - obj_xx = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_yy = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_zz = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_pxx = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_pyy = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_pzz = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_id11 = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); - obj_id22 = (pdcid_t *)malloc(sizeof(pdcid_t) * timestamps); + obj_xx = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_yy = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_zz = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_pxx = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_pyy = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_pzz = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_id11 = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); + obj_id22 = (pdcid_t *)malloc(sizeof(pdcid_t) * timestep); offset = (uint64_t *)malloc(sizeof(uint64_t) * ndim); offset_remote = (uint64_t *)malloc(sizeof(uint64_t) * ndim); @@ -153,69 +154,101 @@ main(int argc, char **argv) region_id1 = PDCregion_create(ndim, offset, mysize); region_id2 = PDCregion_create(ndim, offset, mysize); - transfer_request_x = (pdcid_t *)malloc(sizeof(pdcid_t) * (timestamps + 1) * N_OBJS); - ptr = transfer_request_x + timestamps; + transfer_request_x = (pdcid_t *)malloc(sizeof(pdcid_t) * (timestep + 1) * N_OBJS); + ptr = transfer_request_x + timestep; transfer_request_y = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_z = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_px = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_py = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_pz = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_id1 = ptr; - ptr += timestamps; + ptr += timestep; transfer_request_id2 = ptr; - ptr += timestamps; + ptr += timestep; temp_requests = ptr; - for (i = 0; i < timestamps; ++i) { + for (i = 0; i < timestep; ++i) { sprintf(obj_name, "obj-var-xx %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_xx[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_xx[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_xx[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-xx"); exit(-1); } sprintf(obj_name, "obj-var-yy %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_yy[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_yy[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_yy[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-yy"); exit(-1); } sprintf(obj_name, "obj-var-zz %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_zz[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_zz[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_zz[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-zz"); exit(-1); } sprintf(obj_name, "obj-var-pxx %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_pxx[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_pxx[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_pxx[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-pxx"); exit(-1); } sprintf(obj_name, "obj-var-pyy %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_pyy[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_pyy[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_pyy[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-pyy"); exit(-1); } sprintf(obj_name, "obj-var-pzz %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_pzz[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_pzz[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_pzz[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj-var-pzz"); exit(-1); } sprintf(obj_name, "id11 %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_id11[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_id11[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_id11[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj_id11"); exit(-1); } sprintf(obj_name, "id22 %" PRIu64 "", i); +#ifdef ENABLE_MPI obj_id22[i] = PDCobj_open_col(obj_name, pdc_id); +#else + obj_id22[i] = PDCobj_open(obj_name, pdc_id); +#endif if (obj_id22[i] == 0) { printf("Error getting an object id of %s from server, exit...\n", "obj_id22"); exit(-1); @@ -227,7 +260,7 @@ main(int argc, char **argv) start_total_time = MPI_Wtime(); #endif - for (i = 0; i < timestamps; ++i) { + for (i = 0; i < timestep; ++i) { offset_remote[0] = rank * numparticles; region_xx = PDCregion_create(ndim, offset_remote, mysize); @@ -244,49 +277,49 @@ main(int argc, char **argv) #endif if (test_method) { transfer_request_x[i] = - PDCregion_transfer_create(&x[0], PDC_WRITE, obj_xx[i], region_x, region_xx); + PDCregion_transfer_create(&x[0], PDC_READ, obj_xx[i], region_x, region_xx); if (transfer_request_x[i] == 0) { printf("Array x transfer request creation failed\n"); return 1; } transfer_request_y[i] = - PDCregion_transfer_create(&y[0], PDC_WRITE, obj_yy[i], region_y, region_yy); + PDCregion_transfer_create(&y[0], PDC_READ, obj_yy[i], region_y, region_yy); if (transfer_request_y[i] == 0) { printf("Array y transfer request creation failed\n"); return 1; } transfer_request_z[i] = - PDCregion_transfer_create(&z[0], PDC_WRITE, obj_zz[i], region_z, region_zz); + PDCregion_transfer_create(&z[0], PDC_READ, obj_zz[i], region_z, region_zz); if (transfer_request_z[i] == 0) { printf("Array z transfer request creation failed\n"); return 1; } transfer_request_px[i] = - PDCregion_transfer_create(&px[0], PDC_WRITE, obj_pxx[i], region_px, region_pxx); + PDCregion_transfer_create(&px[0], PDC_READ, obj_pxx[i], region_px, region_pxx); if (transfer_request_px[i] == 0) { printf("Array px transfer request creation failed\n"); return 1; } transfer_request_py[i] = - PDCregion_transfer_create(&py[0], PDC_WRITE, obj_pyy[i], region_py, region_pyy); + PDCregion_transfer_create(&py[0], PDC_READ, obj_pyy[i], region_py, region_pyy); if (transfer_request_py[i] == 0) { printf("Array py transfer request creation failed\n"); return 1; } transfer_request_pz[i] = - PDCregion_transfer_create(&pz[0], PDC_WRITE, obj_pzz[i], region_pz, region_pzz); + PDCregion_transfer_create(&pz[0], PDC_READ, obj_pzz[i], region_pz, region_pzz); if (transfer_request_pz[i] == 0) { printf("Array pz transfer request creation failed\n"); return 1; } transfer_request_id1[i] = - PDCregion_transfer_create(&id1[0], PDC_WRITE, obj_id11[i], region_id1, region_id11); + PDCregion_transfer_create(&id1[0], PDC_READ, obj_id11[i], region_id1, region_id11); if (transfer_request_id1[i] == 0) { printf("Array id1 transfer request creation failed\n"); return 1; } transfer_request_id2[i] = - PDCregion_transfer_create(&id2[0], PDC_WRITE, obj_id22[i], region_id2, region_id22); + PDCregion_transfer_create(&id2[0], PDC_READ, obj_id22[i], region_id2, region_id22); if (transfer_request_id2[i] == 0) { printf("Array id2 transfer request creation failed\n"); return 1; @@ -549,7 +582,7 @@ main(int argc, char **argv) MPI_Barrier(MPI_COMM_WORLD); #endif - for (i = 0; i < timestamps; ++i) { + for (i = 0; i < timestep; ++i) { if (PDCobj_close(obj_xx[i]) < 0) { printf("fail to close obj_xx\n"); return 1; diff --git a/examples/mpi_test.sh b/examples/mpi_test.sh index de962fcaa..99b710919 100755 --- a/examples/mpi_test.sh +++ b/examples/mpi_test.sh @@ -4,8 +4,8 @@ # defined and points to the MPI libraries used by the linker (e.g. -Lname); - p = PDC_FREE(struct _pdc_class, p); + p = (struct _pdc_class *)(intptr_t)PDC_free(p); FUNC_LEAVE(ret_value); } @@ -214,7 +214,7 @@ PDCclose(pdcid_t pdcid) PDC_class_end(); - pdc_id_list_g = PDC_FREE(struct pdc_id_list, pdc_id_list_g); + pdc_id_list_g = (struct pdc_id_list *)(intptr_t)PDC_free(pdc_id_list_g); // Finalize METADATA PDC_Client_finalize(); diff --git a/src/api/pdc_analysis/pdc_analysis.c b/src/api/pdc_analysis/pdc_analysis.c index 3e603df4d..0add84746 100644 --- a/src/api/pdc_analysis/pdc_analysis.c +++ b/src/api/pdc_analysis/pdc_analysis.c @@ -453,7 +453,8 @@ PDCobj_analysis_register(char *func, pdcid_t iterIn, pdcid_t iterOut) if ((ftnPtr = ftnHandle) == NULL) PGOTO_ERROR(FAIL, "Analysis function lookup failed"); - if ((thisFtn = PDC_MALLOC(struct _pdc_region_analysis_ftn_info)) == NULL) + if ((thisFtn = (struct _pdc_region_analysis_ftn_info *)PDC_malloc( + sizeof(struct _pdc_region_analysis_ftn_info))) == NULL) PGOTO_ERROR(FAIL, "PDC register_obj_analysis memory allocation failed"); thisFtn->ftnPtr = (int (*)())ftnPtr; diff --git a/src/api/pdc_obj/pdc_cont.c b/src/api/pdc_obj/pdc_cont.c index b589188e6..4366c4156 100644 --- a/src/api/pdc_obj/pdc_cont.c +++ b/src/api/pdc_obj/pdc_cont.c @@ -61,11 +61,11 @@ PDCcont_create(const char *cont_name, pdcid_t cont_prop_id) FUNC_ENTER(NULL); - p = PDC_MALLOC(struct _pdc_cont_info); + p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info)); if (!p) PGOTO_ERROR(0, "PDC container memory allocation failed"); - p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info); + p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info)); if (!p->cont_info_pub) PGOTO_ERROR(0, "PDC pub container memory allocation failed"); p->cont_info_pub->name = strdup(cont_name); @@ -73,12 +73,12 @@ PDCcont_create(const char *cont_name, pdcid_t cont_prop_id) id_info = PDC_find_id(cont_prop_id); cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr); - p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont_pt) PGOTO_ERROR(0, "PDC container prop memory allocation failed"); memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop)); - p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont_pt->pdc) PGOTO_ERROR(0, "PDC container pdc class memory allocation failed"); if (cont_prop->pdc->name) @@ -110,11 +110,11 @@ PDCcont_create_col(const char *cont_name, pdcid_t cont_prop_id) FUNC_ENTER(NULL); - p = PDC_MALLOC(struct _pdc_cont_info); + p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info)); if (!p) PGOTO_ERROR(0, "PDC container memory allocation failed"); - p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info); + p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info)); if (!p->cont_info_pub) PGOTO_ERROR(0, "PDC pub container memory allocation failed"); p->cont_info_pub->name = strdup(cont_name); @@ -122,12 +122,12 @@ PDCcont_create_col(const char *cont_name, pdcid_t cont_prop_id) id_info = PDC_find_id(cont_prop_id); cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr); - p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont_pt) PGOTO_ERROR(0, "PDC container prop memory allocation failed"); memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop)); - p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont_pt->pdc) PGOTO_ERROR(0, "PDC container pdc class memory allocation failed"); if (cont_prop->pdc->name) @@ -157,11 +157,11 @@ PDC_cont_create_local(pdcid_t pdc, const char *cont_name, uint64_t cont_meta_id) FUNC_ENTER(NULL); - p = PDC_MALLOC(struct _pdc_cont_info); + p = (struct _pdc_cont_info *)PDC_malloc(sizeof(struct _pdc_cont_info)); if (!p) PGOTO_ERROR(0, "PDC container memory allocation failed"); - p->cont_info_pub = PDC_MALLOC(struct pdc_cont_info); + p->cont_info_pub = (struct pdc_cont_info *)PDC_malloc(sizeof(struct pdc_cont_info)); if (!p) PGOTO_ERROR(0, "PDC container memory allocation failed"); p->cont_info_pub->name = strdup(cont_name); @@ -171,12 +171,12 @@ PDC_cont_create_local(pdcid_t pdc, const char *cont_name, uint64_t cont_meta_id) id_info = PDC_find_id(cont_prop_id); cont_prop = (struct _pdc_cont_prop *)(id_info->obj_ptr); - p->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + p->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont_pt) PGOTO_ERROR(0, "PDC container prop memory allocation failed"); memcpy(p->cont_pt, cont_prop, sizeof(struct _pdc_cont_prop)); - p->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont_pt->pdc) PGOTO_ERROR(0, "PDC container pdc class memory allocation failed"); @@ -222,11 +222,11 @@ PDC_cont_close(struct _pdc_cont_info *cp) FUNC_ENTER(NULL); free((void *)(cp->cont_info_pub->name)); - cp->cont_info_pub = PDC_FREE(struct pdc_cont_info, cp->cont_info_pub); + cp->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(cp->cont_info_pub); free(cp->cont_pt->pdc->name); - cp->cont_pt->pdc = PDC_FREE(struct _pdc_class, cp->cont_pt->pdc); - cp->cont_pt = PDC_FREE(struct _pdc_cont_prop, cp->cont_pt); - cp = PDC_FREE(struct _pdc_cont_info, cp); + cp->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->cont_pt->pdc); + cp->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(cp->cont_pt); + cp = (struct _pdc_cont_info *)(intptr_t)PDC_free(cp); FUNC_LEAVE(ret_value); } @@ -321,25 +321,25 @@ PDC_cont_get_info(pdcid_t cont_id) PGOTO_ERROR(NULL, "cannot locate object"); info = (struct _pdc_cont_info *)(id_info->obj_ptr); - ret_value = PDC_CALLOC(1, struct _pdc_cont_info); + ret_value = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info)); if (ret_value) memcpy(ret_value, info, sizeof(struct _pdc_cont_info)); else PGOTO_ERROR(NULL, "cannot allocate ret_value"); - ret_value->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info); + ret_value->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (ret_value->cont_info_pub) memcpy(ret_value->cont_info_pub, info->cont_info_pub, sizeof(struct pdc_cont_info)); if (info->cont_info_pub->name) ret_value->cont_info_pub->name = strdup(info->cont_info_pub->name); - ret_value->cont_pt = PDC_MALLOC(struct _pdc_cont_prop); + ret_value->cont_pt = (struct _pdc_cont_prop *)PDC_malloc(sizeof(struct _pdc_cont_prop)); if (ret_value->cont_pt) memcpy(ret_value->cont_pt, info->cont_pt, sizeof(struct _pdc_cont_prop)); else PGOTO_ERROR(NULL, "cannot allocate ret_value->cont_pt"); - ret_value->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + ret_value->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (ret_value->cont_pt->pdc) { ret_value->cont_pt->pdc->local_id = info->cont_pt->pdc->local_id; if (info->cont_pt->pdc->name) @@ -366,7 +366,7 @@ PDCcont_get_info(const char *cont_name) tmp = PDC_cont_get_info(cont_id); - ret_value = PDC_CALLOC(1, struct pdc_cont_info); + ret_value = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (!ret_value) PGOTO_ERROR(NULL, "cannot allocate memory"); @@ -440,7 +440,7 @@ PDCcont_iter_get_info(cont_handle *chandle) if (info == NULL) PGOTO_ERROR(NULL, "PDC container info memory allocation failed"); - ret_value = PDC_CALLOC(1, struct pdc_cont_info); + ret_value = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (!ret_value) PGOTO_ERROR(NULL, "failed to allocate memory"); diff --git a/src/api/pdc_obj/pdc_obj.c b/src/api/pdc_obj/pdc_obj.c index 95687826c..9b307e5fa 100644 --- a/src/api/pdc_obj/pdc_obj.c +++ b/src/api/pdc_obj/pdc_obj.c @@ -72,7 +72,7 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id) pdcid_t ret_value = 0; FUNC_ENTER(NULL); #if 0 - p = PDC_MALLOC(struct _pdc_obj_info); + p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info)); if (!p) PGOTO_ERROR(0, "PDC object memory allocation failed"); p->metadata = NULL; @@ -86,24 +86,24 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id) cont_info = (struct _pdc_cont_info *)(id_info->obj_ptr); /* struct _pdc_cont_info field */ - p->cont = PDC_CALLOC(1,struct _pdc_cont_info); + p->cont = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info)); if (!p->cont) PGOTO_ERROR(0, "PDC object container memory allocation failed"); memcpy(p->cont, cont_info, sizeof(struct _pdc_cont_info)); - p->cont->cont_info_pub = PDC_CALLOC(1,struct pdc_cont_info); + p->cont->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (!p->cont->cont_info_pub) PGOTO_ERROR(0, "PDC object pub container memory allocation failed"); memcpy(p->cont->cont_info_pub, cont_info->cont_info_pub, sizeof(struct pdc_cont_info)); if (cont_info->cont_info_pub->name) p->cont->cont_info_pub->name = strdup(cont_info->cont_info_pub->name); - p->cont->cont_pt = PDC_CALLOC(1,struct _pdc_cont_prop); + p->cont->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont->cont_pt) PGOTO_ERROR(0, "PDC object container property memory allocation failed"); memcpy(p->cont->cont_pt, cont_info->cont_pt, sizeof(struct _pdc_cont_prop)); - p->cont->cont_pt->pdc = PDC_CALLOC(1,struct _pdc_class); + p->cont->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont->cont_pt->pdc) PGOTO_ERROR(0, "PDC object container property pdc memory allocation failed"); p->cont->cont_pt->pdc->name = strdup(cont_info->cont_pt->pdc->name); @@ -115,20 +115,20 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id) obj_prop = (struct _pdc_obj_prop *)(id_info->obj_ptr); /* struct _pdc_obj_prop field */ - p->obj_pt = PDC_CALLOC(1,struct _pdc_obj_prop); + p->obj_pt = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (!p->obj_pt) PGOTO_ERROR(0, "PDC object property memory allocation failed"); memcpy(p->obj_pt, obj_prop, sizeof(struct _pdc_obj_prop)); if (obj_prop->app_name) p->obj_pt->app_name = strdup(obj_prop->app_name); - p->obj_pt->pdc = PDC_CALLOC(1,struct _pdc_class); + p->obj_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->obj_pt->pdc) PGOTO_ERROR(0, "cannot allocate ret_value->pdc"); p->obj_pt->pdc->name = strdup(obj_prop->pdc->name); p->obj_pt->pdc->local_id = obj_prop->pdc->local_id; /* struct pdc_obj_prop field */ - p->obj_pt->obj_prop_pub = PDC_CALLOC(1,struct pdc_obj_prop); + p->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_pt->obj_prop_pub) PGOTO_ERROR(0, "cannot allocate ret_value->obj_pt->obj_prop_pub"); p->obj_pt->obj_prop_pub->ndim = obj_prop->obj_prop_pub->ndim; @@ -146,7 +146,7 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id) if (obj_prop->tags) p->obj_pt->tags = strdup(obj_prop->tags); - p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info); + p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info)); if (!p->obj_info_pub) PGOTO_ERROR(0, "PDC pub object memory allocation failed"); p->obj_info_pub->name = strdup(obj_name); @@ -156,7 +156,7 @@ PDCobj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id) if (ret == FAIL) PGOTO_ERROR(0, "Unable to create object on server!"); - p->obj_info_pub->obj_pt = PDC_CALLOC(1,struct pdc_obj_prop); + p->obj_info_pub->obj_pt = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_info_pub->obj_pt) PGOTO_ERROR(0, "PDC object prop memory allocation failed"); memcpy(p->obj_info_pub->obj_pt, p->obj_pt->obj_prop_pub, sizeof(struct pdc_obj_prop)); @@ -239,7 +239,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ FUNC_ENTER(NULL); - p = PDC_MALLOC(struct _pdc_obj_info); + p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info)); if (!p) PGOTO_ERROR(0, "PDC object memory allocation failed"); p->metadata = NULL; @@ -254,13 +254,13 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ /* struct _pdc_cont_info field */ cont_info = (struct _pdc_cont_info *)(id_info->obj_ptr); - p->cont = PDC_CALLOC(1, struct _pdc_cont_info); + p->cont = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info)); if (!p->cont) PGOTO_ERROR(0, "PDC object container memory allocation failed"); memcpy(p->cont, cont_info, sizeof(struct _pdc_cont_info)); /* struct pdc_cont_info field */ - p->cont->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info); + p->cont->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (!p->cont->cont_info_pub) PGOTO_ERROR(0, "PDC object pub container memory allocation failed"); memcpy(p->cont->cont_info_pub, cont_info->cont_info_pub, sizeof(struct pdc_cont_info)); @@ -268,13 +268,13 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ p->cont->cont_info_pub->name = strdup(cont_info->cont_info_pub->name); /* struct _pdc_cont_prop field */ - p->cont->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + p->cont->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont->cont_pt) PGOTO_ERROR(0, "PDC object container property memory allocation failed"); memcpy(p->cont->cont_pt, cont_info->cont_pt, sizeof(struct _pdc_cont_prop)); /* struct _pdc_class field */ - p->cont->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->cont->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont->cont_pt->pdc) PGOTO_ERROR(0, "PDC object container property pdc memory allocation failed"); if (cont_info->cont_pt->pdc->name) @@ -287,7 +287,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ obj_prop = (struct _pdc_obj_prop *)(id_info->obj_ptr); /* struct _pdc_obj_prop field */ - p->obj_pt = PDC_CALLOC(1, struct _pdc_obj_prop); + p->obj_pt = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (!p->obj_pt) PGOTO_ERROR(0, "PDC object property memory allocation failed"); memcpy(p->obj_pt, obj_prop, sizeof(struct _pdc_obj_prop)); @@ -299,7 +299,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ p->obj_pt->tags = strdup(obj_prop->tags); p->obj_pt->locus = PDC_get_execution_locus(); - p->obj_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->obj_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->obj_pt->pdc) PGOTO_ERROR(0, "cannot allocate ret_value->pdc"); if (obj_prop->pdc->name) @@ -307,7 +307,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ p->obj_pt->pdc->local_id = obj_prop->pdc->local_id; /* struct pdc_obj_prop field */ - p->obj_pt->obj_prop_pub = PDC_CALLOC(1, struct pdc_obj_prop); + p->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_pt->obj_prop_pub) PGOTO_ERROR(0, "cannot allocate ret_value->obj_pt->obj_prop_pub"); p->obj_pt->obj_prop_pub->ndim = obj_prop->obj_prop_pub->ndim; @@ -329,7 +329,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ p->local_transfer_request_end = NULL; p->local_transfer_request_size = 0; /* struct pdc_obj_info field */ - p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info); + p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info)); if (!p->obj_info_pub) PGOTO_ERROR(0, "PDC pub object memory allocation failed"); p->obj_info_pub->name = strdup(obj_name); @@ -349,7 +349,7 @@ PDC_obj_create(pdcid_t cont_id, const char *obj_name, pdcid_t obj_prop_id, _pdc_ p->obj_pt->obj_prop_pub->region_partition, p->obj_pt->obj_prop_pub->consistency, p); - p->obj_info_pub->obj_pt = PDC_CALLOC(1, struct pdc_obj_prop); + p->obj_info_pub->obj_pt = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_info_pub->obj_pt) PGOTO_ERROR(0, "PDC object prop memory allocation failed"); memcpy(p->obj_info_pub->obj_pt, p->obj_pt->obj_prop_pub, sizeof(struct pdc_obj_prop)); @@ -417,28 +417,28 @@ PDC_obj_close(struct _pdc_obj_info *op) free((void *)(op->obj_info_pub->name)); free(op->cont->cont_info_pub->name); - op->cont->cont_info_pub = PDC_FREE(struct pdc_cont_info, op->cont->cont_info_pub); + op->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(op->cont->cont_info_pub); free(op->cont->cont_pt->pdc->name); - op->cont->cont_pt->pdc = PDC_FREE(struct _pdc_class, op->cont->cont_pt->pdc); - op->cont->cont_pt = PDC_FREE(struct _pdc_cont_prop, op->cont->cont_pt); - op->cont = PDC_FREE(struct _pdc_cont_info, op->cont); + op->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(op->cont->cont_pt->pdc); + op->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(op->cont->cont_pt); + op->cont = (struct _pdc_cont_info *)(intptr_t)PDC_free(op->cont); free(op->obj_pt->pdc->name); - op->obj_pt->pdc = PDC_FREE(struct _pdc_class, op->obj_pt->pdc); + op->obj_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(op->obj_pt->pdc); free(op->obj_pt->obj_prop_pub->dims); - op->obj_pt->obj_prop_pub = PDC_FREE(struct pdc_obj_prop, op->obj_pt->obj_prop_pub); + op->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t)PDC_free(op->obj_pt->obj_prop_pub); free(op->obj_pt->app_name); free(op->obj_pt->data_loc); free(op->obj_pt->tags); - op->obj_pt = PDC_FREE(struct _pdc_obj_prop, op->obj_pt); + op->obj_pt = (struct _pdc_obj_prop *)(intptr_t)PDC_free(op->obj_pt); if (op->metadata != NULL) free(op->metadata); free(op->obj_info_pub->obj_pt->dims); - op->obj_info_pub->obj_pt = PDC_FREE(struct pdc_obj_prop, op->obj_info_pub->obj_pt); - op->obj_info_pub = PDC_FREE(struct pdc_obj_info, op->obj_info_pub); + op->obj_info_pub->obj_pt = (struct pdc_obj_prop *)(intptr_t)PDC_free(op->obj_info_pub->obj_pt); + op->obj_info_pub = (struct pdc_obj_info *)(intptr_t)PDC_free(op->obj_info_pub); - op = PDC_FREE(struct _pdc_obj_info, op); + op = (struct _pdc_obj_info *)(intptr_t)PDC_free(op); FUNC_LEAVE(ret_value); } @@ -537,34 +537,34 @@ PDCobj_open_common(const char *obj_name, pdcid_t pdc, int is_col) FUNC_ENTER(NULL); - p = PDC_MALLOC(struct _pdc_obj_info); + p = (struct _pdc_obj_info *)PDC_malloc(sizeof(struct _pdc_obj_info)); if (!p) PGOTO_ERROR(0, "PDC object memory allocation failed"); - p->cont = PDC_CALLOC(1, struct _pdc_cont_info); + p->cont = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info)); if (!p->cont) PGOTO_ERROR(0, "PDC object container memory allocation failed"); - p->cont->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info); + p->cont->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (!p->cont->cont_info_pub) PGOTO_ERROR(0, "PDC object pub container memory allocation failed"); - p->cont->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + p->cont->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!p->cont->cont_pt) PGOTO_ERROR(0, "PDC object container property memory allocation failed"); - p->cont->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->cont->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->cont->cont_pt->pdc) PGOTO_ERROR(0, "PDC object container property pdc memory allocation failed"); - p->obj_pt = PDC_CALLOC(1, struct _pdc_obj_prop); + p->obj_pt = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (!p->obj_pt) PGOTO_ERROR(0, "PDC object property memory allocation failed"); - p->obj_pt->obj_prop_pub = PDC_CALLOC(1, struct pdc_obj_prop); + p->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_pt->obj_prop_pub) PGOTO_ERROR(0, "PDC object property memory allocation failed"); - p->obj_info_pub = PDC_MALLOC(struct pdc_obj_info); + p->obj_info_pub = (struct pdc_obj_info *)PDC_malloc(sizeof(struct pdc_obj_info)); if (!p->obj_info_pub) PGOTO_ERROR(0, "PDC pub object memory allocation failed"); - p->obj_info_pub->obj_pt = PDC_CALLOC(1, struct pdc_obj_prop); + p->obj_info_pub->obj_pt = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!p->obj_info_pub->obj_pt) PGOTO_ERROR(0, "PDC object prop memory allocation failed"); - p->obj_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + p->obj_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!p->obj_pt->pdc) PGOTO_ERROR(0, "cannot allocate ret_value->pdc"); @@ -738,12 +738,12 @@ PDCobj_iter_get_info(obj_handle *ohandle) if (info == NULL) PGOTO_ERROR(NULL, "PDC container info memory allocation failed"); - ret_value = PDC_CALLOC(1, struct pdc_obj_info); + ret_value = (struct pdc_obj_info *)PDC_calloc(1, sizeof(struct pdc_obj_info)); if (!ret_value) PGOTO_ERROR(NULL, "failed to allocate memory"); memcpy(ret_value, info->obj_info_pub, sizeof(struct pdc_obj_info)); - ret_value->obj_pt = PDC_CALLOC(1, struct pdc_obj_prop); + ret_value->obj_pt = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!ret_value->obj_pt) PGOTO_ERROR(NULL, "failed to allocate memory"); memcpy(ret_value->obj_pt, info->obj_info_pub->obj_pt, sizeof(struct pdc_obj_prop)); @@ -1058,14 +1058,14 @@ PDC_obj_get_info(pdcid_t obj_id) PGOTO_ERROR(NULL, "cannot locate object"); info = (struct _pdc_obj_info *)(obj->obj_ptr); - ret_value = PDC_CALLOC(1, struct _pdc_obj_info); + ret_value = (struct _pdc_obj_info *)PDC_calloc(1, sizeof(struct _pdc_obj_info)); if (ret_value) memcpy(ret_value, info, sizeof(struct _pdc_obj_info)); else PGOTO_ERROR(NULL, "cannot allocate ret_value"); /* struct pdc_obj_info field */ - ret_value->obj_info_pub = PDC_CALLOC(1, struct pdc_obj_info); + ret_value->obj_info_pub = (struct pdc_obj_info *)PDC_calloc(1, sizeof(struct pdc_obj_info)); if (ret_value->obj_info_pub) memcpy(ret_value->obj_info_pub, info->obj_info_pub, sizeof(struct pdc_obj_info)); else @@ -1075,7 +1075,7 @@ PDC_obj_get_info(pdcid_t obj_id) else ret_value->obj_info_pub->name = NULL; - ret_value->obj_info_pub->obj_pt = PDC_CALLOC(1, struct pdc_obj_prop); + ret_value->obj_info_pub->obj_pt = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (!ret_value->obj_info_pub->obj_pt) PGOTO_ERROR(NULL, "failed to allocate memory"); memcpy(ret_value->obj_info_pub->obj_pt, info->obj_info_pub->obj_pt, sizeof(struct pdc_obj_prop)); @@ -1089,13 +1089,13 @@ PDC_obj_get_info(pdcid_t obj_id) ret_value->metadata = NULL; // fill in struct _pdc_cont_info field in ret_value->cont - ret_value->cont = PDC_CALLOC(1, struct _pdc_cont_info); + ret_value->cont = (struct _pdc_cont_info *)PDC_calloc(1, sizeof(struct _pdc_cont_info)); if (ret_value->cont) memcpy(ret_value->cont, info->cont, sizeof(struct _pdc_cont_info)); else PGOTO_ERROR(NULL, "cannot allocate ret_value->cont"); - ret_value->cont->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info); + ret_value->cont->cont_info_pub = (struct pdc_cont_info *)PDC_calloc(1, sizeof(struct pdc_cont_info)); if (ret_value->cont->cont_info_pub) memcpy(ret_value->cont->cont_info_pub, info->cont->cont_info_pub, sizeof(struct pdc_cont_info)); else @@ -1105,12 +1105,12 @@ PDC_obj_get_info(pdcid_t obj_id) else ret_value->cont->cont_info_pub->name = NULL; - ret_value->cont->cont_pt = PDC_CALLOC(1, struct _pdc_cont_prop); + ret_value->cont->cont_pt = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (ret_value->cont->cont_pt) memcpy(ret_value->cont->cont_pt, info->cont->cont_pt, sizeof(struct _pdc_cont_prop)); else PGOTO_ERROR(NULL, "cannot allocate ret_value->cont->cont_pt"); - ret_value->cont->cont_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + ret_value->cont->cont_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (ret_value->cont->cont_pt->pdc) { ret_value->cont->cont_pt->pdc->local_id = info->cont->cont_pt->pdc->local_id; if (info->cont->cont_pt->pdc->name) @@ -1122,12 +1122,12 @@ PDC_obj_get_info(pdcid_t obj_id) PGOTO_ERROR(NULL, "cannot allocate ret_value->cont->cont_pt->pdc"); // fill in struct _pdc_obj_prop field in ret_value->obj_pt - ret_value->obj_pt = PDC_CALLOC(1, struct _pdc_obj_prop); + ret_value->obj_pt = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (ret_value->obj_pt) memcpy(ret_value->obj_pt, info->obj_pt, sizeof(struct _pdc_obj_prop)); else PGOTO_ERROR(NULL, "cannot allocate ret_value->obj_pt"); - ret_value->obj_pt->pdc = PDC_CALLOC(1, struct _pdc_class); + ret_value->obj_pt->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (ret_value->obj_pt->pdc) { ret_value->obj_pt->pdc->local_id = info->obj_pt->pdc->local_id; if (info->obj_pt->pdc->name) @@ -1138,7 +1138,7 @@ PDC_obj_get_info(pdcid_t obj_id) else PGOTO_ERROR(NULL, "cannot allocate ret_value->obj_pt->pdc"); - ret_value->obj_pt->obj_prop_pub = PDC_CALLOC(1, struct pdc_obj_prop); + ret_value->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (ret_value->obj_pt->obj_prop_pub) memcpy(ret_value->obj_pt->obj_prop_pub, info->obj_pt->obj_prop_pub, sizeof(struct pdc_obj_prop)); else @@ -1182,7 +1182,7 @@ PDC_free_obj_info(struct _pdc_obj_info *obj) if (obj->obj_info_pub->name != NULL) free(obj->obj_info_pub->name); - obj->obj_info_pub = PDC_FREE(struct pdc_obj_info, obj->obj_info_pub); + obj->obj_info_pub = (struct pdc_obj_info *)(intptr_t)PDC_free(obj->obj_info_pub); if (obj->metadata != NULL) free(obj->metadata); @@ -1190,36 +1190,36 @@ PDC_free_obj_info(struct _pdc_obj_info *obj) if (obj->cont != NULL) { if (obj->cont->cont_info_pub->name != NULL) free(obj->cont->cont_info_pub->name); - obj->cont->cont_info_pub = PDC_FREE(struct pdc_cont_info, obj->cont->cont_info_pub); + obj->cont->cont_info_pub = (struct pdc_cont_info *)(intptr_t)PDC_free(obj->cont->cont_info_pub); if (obj->cont->cont_pt->pdc->name != NULL) free(obj->cont->cont_pt->pdc->name); - obj->cont->cont_pt->pdc = PDC_FREE(struct _pdc_class, obj->cont->cont_pt->pdc); - obj->cont->cont_pt = PDC_FREE(struct _pdc_cont_prop, obj->cont->cont_pt); - obj->cont = PDC_FREE(struct _pdc_cont_info, obj->cont); + obj->cont->cont_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(obj->cont->cont_pt->pdc); + obj->cont->cont_pt = (struct _pdc_cont_prop *)(intptr_t)PDC_free(obj->cont->cont_pt); + obj->cont = (struct _pdc_cont_info *)(intptr_t)PDC_free(obj->cont); } if (obj->obj_pt != NULL) { if (obj->obj_pt->pdc != NULL) { if (obj->obj_pt->pdc->name != NULL) free(obj->obj_pt->pdc->name); - obj->obj_pt->pdc = PDC_FREE(struct _pdc_class, obj->obj_pt->pdc); + obj->obj_pt->pdc = (struct _pdc_class *)(intptr_t)PDC_free(obj->obj_pt->pdc); } if (obj->obj_pt->obj_prop_pub->dims != NULL) free(obj->obj_pt->obj_prop_pub->dims); - obj->obj_pt->obj_prop_pub = PDC_FREE(struct pdc_obj_prop, obj->obj_pt->obj_prop_pub); + obj->obj_pt->obj_prop_pub = (struct pdc_obj_prop *)(intptr_t)PDC_free(obj->obj_pt->obj_prop_pub); if (obj->obj_pt->app_name != NULL) free(obj->obj_pt->app_name); if (obj->obj_pt->data_loc != NULL) free(obj->obj_pt->data_loc); if (obj->obj_pt->tags != NULL) free(obj->obj_pt->tags); - obj->obj_pt = PDC_FREE(struct _pdc_obj_prop, obj->obj_pt); + obj->obj_pt = (struct _pdc_obj_prop *)(intptr_t)PDC_free(obj->obj_pt); } if (obj->region_list_head != NULL) free(obj->region_list_head); - obj = PDC_FREE(struct _pdc_obj_info, obj); + obj = (struct _pdc_obj_info *)(intptr_t)PDC_free(obj); FUNC_LEAVE(ret_value); } diff --git a/src/api/pdc_obj/pdc_prop.c b/src/api/pdc_obj/pdc_prop.c index e0632b733..65f1985ec 100644 --- a/src/api/pdc_obj/pdc_prop.c +++ b/src/api/pdc_obj/pdc_prop.c @@ -67,7 +67,7 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid) FUNC_ENTER(NULL); if (type == PDC_CONT_CREATE) { - p = PDC_MALLOC(struct _pdc_cont_prop); + p = (struct _pdc_cont_prop *)PDC_malloc(sizeof(struct _pdc_cont_prop)); if (!p) PGOTO_ERROR(0, "PDC container property memory allocation failed"); p->cont_life = PDC_PERSIST; @@ -75,7 +75,7 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid) p->cont_prop_id = new_id_c; id_info = PDC_find_id(pdcid); pdc_class = (struct _pdc_class *)(id_info->obj_ptr); - p->pdc = PDC_CALLOC(1, struct _pdc_class); + p->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (p->pdc == NULL) PGOTO_ERROR(0, "PDC class allocation failed"); if (pdc_class->name) @@ -85,10 +85,10 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid) ret_value = new_id_c; } if (type == PDC_OBJ_CREATE) { - q = PDC_MALLOC(struct _pdc_obj_prop); + q = (struct _pdc_obj_prop *)PDC_malloc(sizeof(struct _pdc_obj_prop)); if (!q) PGOTO_ERROR(0, "PDC object property memory allocation failed"); - q->obj_prop_pub = PDC_MALLOC(struct pdc_obj_prop); + q->obj_prop_pub = (struct pdc_obj_prop *)PDC_malloc(sizeof(struct pdc_obj_prop)); if (!q->obj_prop_pub) PGOTO_ERROR(0, "PDC object pub property memory allocation failed"); q->obj_prop_pub->ndim = 0; @@ -105,7 +105,7 @@ PDCprop_create(pdc_prop_type_t type, pdcid_t pdcid) q->obj_prop_pub->obj_prop_id = new_id_o; id_info = PDC_find_id(pdcid); pdc_class = (struct _pdc_class *)(id_info->obj_ptr); - q->pdc = PDC_CALLOC(1, struct _pdc_class); + q->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (q->pdc == NULL) PGOTO_ERROR(0, "PDC class allocation failed"); if (pdc_class->name) @@ -141,7 +141,7 @@ PDCprop_obj_dup(pdcid_t prop_id) PGOTO_ERROR(0, "cannot locate object property"); info = (struct _pdc_obj_prop *)(prop->obj_ptr); - q = PDC_CALLOC(1, struct _pdc_obj_prop); + q = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (!q) PGOTO_ERROR(0, "PDC object property memory allocation failed"); if (info->app_name) @@ -153,7 +153,7 @@ PDCprop_obj_dup(pdcid_t prop_id) q->buf = NULL; /* struct obj_prop_pub field */ - q->obj_prop_pub = PDC_MALLOC(struct pdc_obj_prop); + q->obj_prop_pub = (struct pdc_obj_prop *)PDC_malloc(sizeof(struct pdc_obj_prop)); if (!q->obj_prop_pub) PGOTO_ERROR(0, "PDC object property memory allocation failed"); new_id = PDC_id_register(PDC_OBJ_PROP, q); @@ -166,7 +166,7 @@ PDCprop_obj_dup(pdcid_t prop_id) (q->obj_prop_pub->dims)[i] = (info->obj_prop_pub->dims)[i]; /* struct _pdc_class field */ - q->pdc = PDC_CALLOC(1, struct _pdc_class); + q->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!q->pdc) PGOTO_ERROR(0, "PDC class memory allocation failed"); if (info->pdc->name) @@ -228,8 +228,8 @@ pdc_prop_cont_close(struct _pdc_cont_prop *cp) FUNC_ENTER(NULL); free(cp->pdc->name); - cp->pdc = PDC_FREE(struct _pdc_class, cp->pdc); - cp = PDC_FREE(struct _pdc_cont_prop, cp); + cp->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->pdc); + cp = (struct _pdc_cont_prop *)(intptr_t)PDC_free(cp); FUNC_LEAVE(ret_value); } @@ -242,7 +242,7 @@ pdc_prop_obj_close(struct _pdc_obj_prop *cp) FUNC_ENTER(NULL); free(cp->pdc->name); - cp->pdc = PDC_FREE(struct _pdc_class, cp->pdc); + cp->pdc = (struct _pdc_class *)(intptr_t)PDC_free(cp->pdc); if (cp->obj_prop_pub->dims != NULL) { free(cp->obj_prop_pub->dims); cp->obj_prop_pub->dims = NULL; @@ -250,7 +250,7 @@ pdc_prop_obj_close(struct _pdc_obj_prop *cp) free(cp->app_name); free(cp->tags); free(cp->data_loc); - cp = PDC_FREE(struct _pdc_obj_prop, cp); + cp = (struct _pdc_obj_prop *)(intptr_t)PDC_free(cp); FUNC_LEAVE(ret_value); } @@ -303,13 +303,13 @@ PDCcont_prop_get_info(pdcid_t cont_prop) PGOTO_ERROR(NULL, "cannot allocate container property"); info = (struct _pdc_cont_prop *)(prop->obj_ptr); - ret_value = PDC_CALLOC(1, struct _pdc_cont_prop); + ret_value = (struct _pdc_cont_prop *)PDC_calloc(1, sizeof(struct _pdc_cont_prop)); if (!ret_value) PGOTO_ERROR(NULL, "PDC container property memory allocation failed"); ret_value->cont_life = info->cont_life; ret_value->cont_prop_id = info->cont_prop_id; - ret_value->pdc = PDC_CALLOC(1, struct _pdc_class); + ret_value->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (!ret_value->pdc) PGOTO_ERROR(NULL, "cannot allocate ret_value->pdc"); if (info->pdc->name) @@ -336,7 +336,7 @@ PDCobj_prop_get_info(pdcid_t obj_prop) PGOTO_ERROR(NULL, "cannot locate object property"); info = (struct _pdc_obj_prop *)(prop->obj_ptr); - ret_value = PDC_CALLOC(1, struct pdc_obj_prop); + ret_value = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (ret_value == NULL) PGOTO_ERROR(NULL, "PDC object property memory allocation failed"); memcpy(ret_value, info->obj_prop_pub, sizeof(struct pdc_obj_prop)); @@ -367,7 +367,7 @@ PDC_obj_prop_get_info(pdcid_t obj_prop) PGOTO_ERROR(NULL, "cannot locate object property"); info = (struct _pdc_obj_prop *)(prop->obj_ptr); - ret_value = PDC_CALLOC(1, struct _pdc_obj_prop); + ret_value = (struct _pdc_obj_prop *)PDC_calloc(1, sizeof(struct _pdc_obj_prop)); if (ret_value == NULL) PGOTO_ERROR(NULL, "PDC object property memory allocation failed"); memcpy(ret_value, info, sizeof(struct _pdc_obj_prop)); @@ -381,7 +381,7 @@ PDC_obj_prop_get_info(pdcid_t obj_prop) ret_value->tags = strdup(info->tags); /* struct _pdc_class field */ - ret_value->pdc = PDC_CALLOC(1, struct _pdc_class); + ret_value->pdc = (struct _pdc_class *)PDC_calloc(1, sizeof(struct _pdc_class)); if (ret_value->pdc == NULL) PGOTO_ERROR(NULL, "cannot allocate ret_value->pdc"); if (info->pdc->name) @@ -389,7 +389,7 @@ PDC_obj_prop_get_info(pdcid_t obj_prop) ret_value->pdc->local_id = info->pdc->local_id; /* struct pdc_obj_prop field */ - ret_value->obj_prop_pub = PDC_CALLOC(1, struct pdc_obj_prop); + ret_value->obj_prop_pub = (struct pdc_obj_prop *)PDC_calloc(1, sizeof(struct pdc_obj_prop)); if (ret_value->obj_prop_pub == NULL) PGOTO_ERROR(NULL, "PDC object pub property memory allocation failed"); memcpy(ret_value->obj_prop_pub, info->obj_prop_pub, sizeof(struct pdc_obj_prop)); diff --git a/src/api/pdc_region/pdc_region.c b/src/api/pdc_region/pdc_region.c index 7192c9234..5b5aa1fe3 100644 --- a/src/api/pdc_region/pdc_region.c +++ b/src/api/pdc_region/pdc_region.c @@ -106,8 +106,8 @@ pdc_region_close(struct pdc_region_info *op) free(op->size); free(op->offset); if (op->obj != NULL) - op->obj = PDC_FREE(struct _pdc_obj_info, op->obj); - op = PDC_FREE(struct pdc_region_info, op); + op->obj = (struct _pdc_obj_info *)(intptr_t)PDC_free(op->obj); + op = (struct pdc_region_info *)(intptr_t)PDC_free(op); FUNC_LEAVE(ret_value); } @@ -184,7 +184,7 @@ PDCregion_create(psize_t ndims, uint64_t *offset, uint64_t *size) FUNC_ENTER(NULL); - p = PDC_MALLOC(struct pdc_region_info); + p = (struct pdc_region_info *)PDC_malloc(sizeof(struct pdc_region_info)); if (!p) PGOTO_ERROR(ret_value, "PDC region memory allocation failed"); p->ndim = ndims; diff --git a/src/api/pdc_region/pdc_region_transfer.c b/src/api/pdc_region/pdc_region_transfer.c index 87f9f3625..ee4e48c8b 100644 --- a/src/api/pdc_region/pdc_region_transfer.c +++ b/src/api/pdc_region/pdc_region_transfer.c @@ -208,7 +208,7 @@ PDCregion_transfer_create(void *buf, pdc_access_t access_type, pdcid_t obj_id, p obj2 = (struct _pdc_obj_info *)(objinfo2->obj_ptr); // remote_meta_id = obj2->obj_info_pub->meta_id; - p = PDC_MALLOC(pdc_transfer_request); + p = (pdc_transfer_request *)PDC_malloc(sizeof(pdc_transfer_request)); p->obj_pointer = obj2; p->mem_type = obj2->obj_pt->obj_prop_pub->type; p->obj_id = obj2->obj_info_pub->meta_id; @@ -903,7 +903,7 @@ register_metadata(pdc_transfer_request_start_all_pkg **transfer_request_input, i * sorted in terms of data_server_id. We pack data from user buffer to contiguous buffers. Static partitioning * requires having at most n_data_servers number of contiguous regions. */ -static int +static perr_t prepare_start_all_requests(pdcid_t *transfer_request_id, int size, pdc_transfer_request_start_all_pkg ***write_transfer_request_ptr, pdc_transfer_request_start_all_pkg ***read_transfer_request_ptr, @@ -934,7 +934,7 @@ prepare_start_all_requests(pdcid_t *transfer_request_id, int size, printf("PDC Client PDCregion_transfer_start_all attempt to start existing transfer request @ " "line %d\n", __LINE__); - return 1; + return FAIL; } if (transfer_request->consistency == PDC_CONSISTENCY_POSIX) { posix_transfer_request_id_ptr[0][posix_size_ptr[0]] = transfer_request_id[i]; @@ -959,6 +959,11 @@ prepare_start_all_requests(pdcid_t *transfer_request_id, int size, &(transfer_request->n_obj_servers), &(transfer_request->obj_servers), &(transfer_request->sub_offsets), &(transfer_request->output_offsets), &(transfer_request->output_sizes), &(transfer_request->output_buf)); + if (transfer_request->n_obj_servers == 0) { + printf("PDC_Client %d, %s: error with static region partition, no server is selected!\n", + pdc_client_mpi_rank_g, __func__); + return FAIL; + } for (j = 0; j < transfer_request->n_obj_servers; ++j) { request_pkgs = (pdc_transfer_request_start_all_pkg *)malloc(sizeof(pdc_transfer_request_start_all_pkg)); @@ -1082,7 +1087,7 @@ prepare_start_all_requests(pdcid_t *transfer_request_id, int size, else { *read_size_ptr = 0; } - return 0; + return SUCCEED; } static int @@ -1321,8 +1326,9 @@ PDCregion_transfer_start_all(pdcid_t *transfer_request_id, int size) FUNC_ENTER(NULL); // Split write and read requests. Handle them separately. // printf("PDCregion_transfer_start_all: checkpoint %d\n", __LINE__); - prepare_start_all_requests(transfer_request_id, size, &write_transfer_requests, &read_transfer_requests, - &write_size, &read_size, &posix_transfer_request_id, &posix_size); + ret_value = prepare_start_all_requests(transfer_request_id, size, &write_transfer_requests, + &read_transfer_requests, &write_size, &read_size, + &posix_transfer_request_id, &posix_size); /* printf("PDCregion_transfer_start_all: checkpoint %d, write_size = %d, read_size = %d\n", __LINE__, write_size, read_size); @@ -1454,12 +1460,18 @@ PDCregion_transfer_start(pdcid_t transfer_request_id) if (transfer_request->region_partition == PDC_REGION_STATIC) { // Identify which part of the region is going to which data server. - static_region_partition(transfer_request->new_buf, transfer_request->remote_region_ndim, unit, - transfer_request->access_type, transfer_request->obj_dims, - transfer_request->remote_region_offset, transfer_request->remote_region_size, - 1, &(transfer_request->n_obj_servers), &(transfer_request->obj_servers), - &(transfer_request->sub_offsets), &(transfer_request->output_offsets), - &(transfer_request->output_sizes), &(transfer_request->output_buf)); + ret_value = static_region_partition( + transfer_request->new_buf, transfer_request->remote_region_ndim, unit, + transfer_request->access_type, transfer_request->obj_dims, transfer_request->remote_region_offset, + transfer_request->remote_region_size, 1, &(transfer_request->n_obj_servers), + &(transfer_request->obj_servers), &(transfer_request->sub_offsets), + &(transfer_request->output_offsets), &(transfer_request->output_sizes), + &(transfer_request->output_buf)); + if (transfer_request->n_obj_servers == 0) { + printf("PDC_Client %d, %s: error with static region partition, no server is selected!\n", + pdc_client_mpi_rank_g, __func__); + return FAIL; + } /* printf("n_obj_servers = %d\n", transfer_request->n_obj_servers); for ( i = 0; i < transfer_request->n_obj_servers; ++i ) { diff --git a/src/api/pdc_transform/pdc_transform.c b/src/api/pdc_transform/pdc_transform.c index d2c8381f5..884cbf434 100644 --- a/src/api/pdc_transform/pdc_transform.c +++ b/src/api/pdc_transform/pdc_transform.c @@ -93,7 +93,8 @@ PDCobj_transform_register(char *func, pdcid_t obj_id, int current_state, int nex if ((ftnPtr = ftnHandle) == NULL) PGOTO_ERROR(FAIL, "Transforms function lookup failed"); - if ((thisFtn = PDC_MALLOC(struct _pdc_region_transform_ftn_info)) == NULL) + if ((thisFtn = (struct _pdc_region_transform_ftn_info *)PDC_malloc( + sizeof(struct _pdc_region_transform_ftn_info))) == NULL) PGOTO_ERROR(FAIL, "PDC register_obj_transforms memory allocation failed"); memset(thisFtn, 0, sizeof(struct _pdc_region_transform_ftn_info)); @@ -206,7 +207,8 @@ PDCbuf_map_transform_register(char *func, void *buf, pdcid_t src_region_id, pdci if ((ftnPtr = ftnHandle) == NULL) PGOTO_ERROR(FAIL, "Transforms function lookup failed\n"); - if ((thisFtn = PDC_MALLOC(struct _pdc_region_transform_ftn_info)) == NULL) + if ((thisFtn = (struct _pdc_region_transform_ftn_info *)PDC_malloc( + sizeof(struct _pdc_region_transform_ftn_info))) == NULL) PGOTO_ERROR(FAIL, "PDC register_obj_transforms memory allocation failed"); thisFtn->ftnPtr = (size_t(*)())ftnPtr; diff --git a/src/commons/utils/include/pdc_malloc.h b/src/commons/utils/include/pdc_malloc.h index 8c3a36335..e967c9032 100644 --- a/src/commons/utils/include/pdc_malloc.h +++ b/src/commons/utils/include/pdc_malloc.h @@ -76,9 +76,4 @@ void *PDC_free(void *mem); */ size_t PDC_get_global_mem_usage(); -#define PDC_MALLOC(t) (t *)PDC_malloc(sizeof(t)) -#define PDC_CALLOC(c, t) (t *)PDC_calloc(c, sizeof(t)) - -#define PDC_FREE(t, obj) (t *)(intptr_t) PDC_free(obj) - #endif /* PDC_MALLOC_H */ diff --git a/src/server/pdc_server_metadata.c b/src/server/pdc_server_metadata.c index b33087173..02380fcc8 100644 --- a/src/server/pdc_server_metadata.c +++ b/src/server/pdc_server_metadata.c @@ -2766,7 +2766,7 @@ PDC_add_kvtag_to_list(pdc_kvtag_list_t **list_head, pdc_kvtag_t *tag) FUNC_ENTER(NULL); PDC_kvtag_dup(tag, &newtag); - new_list_item = PDC_CALLOC(1, pdc_kvtag_list_t); + new_list_item = (pdc_kvtag_list_t *)PDC_calloc(1, sizeof(pdc_kvtag_list_t)); new_list_item->kvtag = newtag; DL_APPEND(*list_head, new_list_item); diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 13c2a5a31..30667ddcd 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -207,6 +207,7 @@ set(SCRIPTS run_test.sh mpi_test.sh run_multiple_test.sh + run_multiple_mpi_test.sh run_checkpoint_restart_test.sh ) @@ -487,6 +488,7 @@ if(BUILD_MPI_TESTING) add_test(NAME obj_info_mpi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND mpi_test.sh ./obj_info ${MPI_RUN_CMD} 4 6 ) add_test(NAME obj_put_data_mpi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND mpi_test.sh ./obj_put_data ${MPI_RUN_CMD} 4 6 ) add_test(NAME obj_get_data_mpi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND mpi_test.sh ./obj_get_data ${MPI_RUN_CMD} 4 6 ) + add_test(NAME vpicio_bdcats_mpi WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND run_multiple_mpi_test.sh ${MPI_RUN_CMD} 4 6 ./vpicio ./bdcats) set_tests_properties(read_obj_shared_int PROPERTIES LABELS "parallel;parallel_obj" ) set_tests_properties(read_obj_shared_float PROPERTIES LABELS "parallel;parallel_obj" ) @@ -514,6 +516,7 @@ if(BUILD_MPI_TESTING) # set_tests_properties(region_transfer_2D_skewed_mpi PROPERTIES LABELS "parallel;parallel_region_transfer" ) # set_tests_properties(region_transfer_3D_skewed_mpi PROPERTIES LABELS "parallel;parallel_region_transfer" ) set_tests_properties(region_transfer_write_read_mpi PROPERTIES LABELS "parallel;parallel_region_transfer" ) + set_tests_properties(vpicio_bdcats_mpi PROPERTIES LABELS "parallel;parallel_region_transfer" ) set_tests_properties(region_transfer_all_mpi PROPERTIES LABELS "parallel;parallel_region_transfer_all" ) set_tests_properties(region_transfer_all_2D_mpi PROPERTIES LABELS "parallel;parallel_region_transfer_all" ) set_tests_properties(region_transfer_all_3D_mpi PROPERTIES LABELS "parallel;parallel_region_transfer_all" ) diff --git a/src/tests/mpi_test.sh b/src/tests/mpi_test.sh index a434fbf07..20d4fba76 100755 --- a/src/tests/mpi_test.sh +++ b/src/tests/mpi_test.sh @@ -4,12 +4,9 @@ # defined and points to the MPI libraries used by the linker (e.g. -LPDC_id_type_list_g)[type_id]) { /* Allocate the type information for new type */ - if (NULL == (type_ptr = PDC_CALLOC(1, struct PDC_id_type))) + if (NULL == (type_ptr = (struct PDC_id_type *)PDC_calloc(1, sizeof(struct PDC_id_type)))) PGOTO_ERROR(FAIL, "ID type allocation failed"); (pdc_id_list_g->PDC_id_type_list_g)[type_id] = type_ptr; } @@ -120,7 +120,7 @@ PDC_id_register(PDC_type_t type, void *object) type_ptr = (pdc_id_list_g->PDC_id_type_list_g)[type]; if (NULL == type_ptr || type_ptr->init_count <= 0) PGOTO_ERROR(ret_value, "invalid type"); - if (NULL == (id_ptr = PDC_MALLOC(struct _pdc_id_info))) + if (NULL == (id_ptr = (struct _pdc_id_info *)PDC_malloc(sizeof(struct _pdc_id_info)))) PGOTO_ERROR(ret_value, "memory allocation failed"); /* Create the struct & it's ID */ @@ -172,7 +172,7 @@ PDC_dec_ref(pdcid_t id) PDC_MUTEX_LOCK(type_ptr->ids); /* Remove the node from the type */ PDC_LIST_REMOVE(id_ptr, entry); - id_ptr = PDC_FREE(struct _pdc_id_info, id_ptr); + id_ptr = (struct _pdc_id_info *)(intptr_t)PDC_free(id_ptr); /* Decrement the number of IDs in the type */ (type_ptr->id_count)--; ret_value = 0; @@ -267,7 +267,7 @@ PDC_id_list_clear(PDC_type_t type) if (!type_ptr->free_func || (type_ptr->free_func)((void *)id_ptr->obj_ptr) >= 0) { PDC_MUTEX_LOCK(type_ptr->ids); PDC_LIST_REMOVE(id_ptr, entry); - id_ptr = PDC_FREE(struct _pdc_id_info, id_ptr); + id_ptr = (struct _pdc_id_info *)(intptr_t)PDC_free(id_ptr); (type_ptr->id_count)--; PDC_MUTEX_UNLOCK(type_ptr->ids); } @@ -289,7 +289,7 @@ PDC_destroy_type(PDC_type_t type) type_ptr = (pdc_id_list_g->PDC_id_type_list_g)[type]; if (type_ptr == NULL) PGOTO_ERROR(FAIL, "type was not initialized correctly"); - type_ptr = PDC_FREE(struct PDC_id_type, type_ptr); + type_ptr = (struct PDC_id_type *)(intptr_t)PDC_free(type_ptr); done: fflush(stdout);