Skip to content

Commit e0024e3

Browse files
fixes for MacOS and new CI to prevent future breaks (#164)
* include MacOS in CI * include dependencies * replace TCP with sockets * add libuuid * fix find UUID to correctly locate files in Ubuntu and MacOS * fix random segfault in strdup + malloc due to wrong allocation * ensure consistent use of defined variables * change transport for MacOS tests * update env * update dependencies-macos.sh * replace found to TRUE/FALSE * update documentation with timeout and MacOS specifics * fix git link to avoid authentication * change transport for tests * configure network for MacOS tests --------- Co-authored-by: github-actions <github-actions[bot]@users.noreply.github.com>
1 parent b1adf8c commit e0024e3

File tree

10 files changed

+146
-56
lines changed

10 files changed

+146
-56
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu -o pipefail
4+
5+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=FALSE
6+
7+
brew install open-mpi automake
8+
9+
# libfabric
10+
wget https://github.com/ofiwg/libfabric/archive/refs/tags/v1.15.2.tar.gz
11+
tar xf v1.15.2.tar.gz
12+
cd libfabric-1.15.2
13+
./autogen.sh
14+
./configure --disable-usnic --disable-mrail --disable-rstream --disable-perf --disable-efa --disable-psm2 --disable-psm --disable-verbs --disable-shm --disable-static --disable-silent-rules
15+
make -j2 && sudo make install
16+
make check
17+
cd ..
18+
19+
# Mercury
20+
git clone --recursive https://github.com/mercury-hpc/mercury.git
21+
cd mercury
22+
git checkout v2.2.0
23+
mkdir build && cd build
24+
cmake ../ -DCMAKE_C_COMPILER=gcc -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DNA_USE_OFI=ON -DNA_USE_SM=OFF -DMERCURY_USE_CHECKSUMS=OFF -DNA_OFI_TESTING_PROTOCOL=sockets
25+
make -j2 && sudo make install
26+
ctest

.github/workflows/macos.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: MacOS
2+
3+
on:
4+
pull_request:
5+
branches: [ stable, develop ]
6+
7+
# Allows to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
jobs:
11+
PDC:
12+
runs-on: macos-13
13+
timeout-minutes: 60
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Dependencies
19+
run: .github/workflows/dependencies-macos.sh
20+
21+
- name: Build PDC
22+
run: |
23+
mkdir build && cd build
24+
cmake ../ -DBUILD_MPI_TESTING=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DPDC_ENABLE_MPI=ON -DCMAKE_C_COMPILER=mpicc
25+
make -j 2
26+
27+
- name: Test PDC
28+
working-directory: build
29+
run: |
30+
sudo sh -c 'echo "`ipconfig getifaddr en0` PDC" >> /etc/hosts'
31+
sudo scutil --set HostName PDC
32+
export HG_TRANSPORT="sockets"
33+
ctest -L serial

.github/workflows/linux.yml .github/workflows/ubuntu.yml

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
name: linux
1+
name: Ubuntu
22

33
on:
4-
# push:
5-
# branches: [ stable ]
64
pull_request:
75
branches: [ stable, develop ]
86

@@ -27,14 +25,6 @@ jobs:
2725
cmake ../ -DBUILD_MPI_TESTING=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DPDC_ENABLE_MPI=ON -DCMAKE_C_COMPILER=mpicc
2826
make -j2
2927
30-
# - name: Debug test PDC
31-
# working-directory: ./src/build/bin
32-
# run: |
33-
# mpirun -n 1 ./pdc_server.exe &
34-
# sleep 1
35-
# mpirun -n 1 ./pdc_init
36-
# mpirun -n 1 ./close_server
37-
3828
- name: Test PDC
3929
working-directory: build
4030
run: ctest -L serial

CMake/FindMERCURY.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ if(MERCURY_FOUND)
2828
)
2929

3030
find_library(MERCURY_UTIL_LIBRARY
31-
NAMES
32-
mercury_util
33-
HINTS ${MERCURY_DIR}
31+
NAMES
32+
mercury_util
33+
HINTS ${MERCURY_DIR}
3434
)
3535

3636
set(MERCURY_LIBRARIES ${MERCURY_LIBRARY} ${MERCURY_NA_LIBRARY} ${MERCURY_UTIL_LIBRARY})

CMake/FindUUID.cmake

+36-31
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
1-
# FindUUID.cmake
1+
# On Mac OS X the uuid functions are in the System library
22

3-
# Find the system's UUID library
4-
# This will define:
5-
#
6-
# UUID_FOUND - System has UUID
7-
# UUID_INCLUDE_DIRS - The UUID include directory
8-
# UUID_LIBRARIES - The libraries needed to use UUID
3+
if(APPLE)
4+
set(UUID_LIBRARY_VAR System)
5+
else()
6+
set(UUID_LIBRARY_VAR uuid)
7+
endif()
98

10-
# - Try to find UUID
11-
# Once done this will define
12-
# UUID_FOUND - System has UUID
13-
# UUID_INCLUDE_DIRS - The UUID include directories
14-
# UUID_LIBRARIES - The libraries needed to use UUID
15-
16-
find_package(PkgConfig)
17-
pkg_check_modules(PC_UUID uuid)
9+
find_library(UUID_LIBRARY
10+
NAMES ${UUID_LIBRARY_VAR}
11+
PATHS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib
12+
)
1813

1914
find_path(UUID_INCLUDE_DIR uuid/uuid.h
2015
HINTS ${PC_UUID_INCLUDEDIR} ${PC_UUID_INCLUDE_DIRS}
21-
PATHS /usr/local/include /usr/include)
22-
23-
find_library(UUID_LIBRARY NAMES uuid
24-
HINTS ${PC_DRC_LIBDIR} ${PC_DRC_LIBRARY_DIRS}
25-
PATHS /usr/local/lib64 /usr/local/lib /usr/lib64 /usr/lib)
26-
27-
set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
28-
set(UUID_LIBRARIES ${UUID_LIBRARY})
29-
30-
include(FindPackageHandleStandardArgs)
31-
# handle the QUIETLY and REQUIRED arguments and set UUID_FOUND to TRUE
32-
# if all listed variables are TRUE
33-
find_package_handle_standard_args(UUID DEFAULT_MSG
34-
UUID_INCLUDE_DIR UUID_LIBRARY)
35-
36-
mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
16+
PATHS /usr/local/include /usr/include
17+
)
18+
19+
if (UUID_LIBRARY AND UUID_INCLUDE_DIR)
20+
set(UUID_LIBRARIES ${UUID_LIBRARY})
21+
set(UUID_FOUND "TRUE")
22+
else ()
23+
set(UUID_FOUND "FALSE")
24+
endif ()
25+
26+
if (UUID_FOUND)
27+
if (NOT UUID_FIND_QUIETLY)
28+
message(STATUS "Found UUID: ${UUID_LIBRARIES}")
29+
endif ()
30+
else ()
31+
if (UUID_FIND_REQUIRED)
32+
message( "library: ${UUID_LIBRARY}" )
33+
message( "include: ${UUID_INCLUDE_DIR}" )
34+
message(FATAL_ERROR "Could not find UUID library")
35+
endif ()
36+
endif ()
37+
38+
mark_as_advanced(
39+
UUID_LIBRARY
40+
UUID_INCLUDE_DIR
41+
)

docs/source/getting_started.rst

+38-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ PDC can use either MPICH or OpenMPI as the MPI library, if your system doesn't h
4242
We provide detailed instructions for installing libfabric, Mercury, and PDC below.
4343

4444
.. attention::
45+
4546
Following the instructions below will record all the environmental variables needed to run PDC in the ``$WORK_SPACE/pdc_env.sh`` file, which can be used for future PDC runs with ``source $WORK_SPACE/pdc_env.sh``.
4647

4748

@@ -57,9 +58,9 @@ Before installing the dependencies and downloading the code repository, we assum
5758
mkdir -p $WORK_SPACE/install
5859
5960
cd $WORK_SPACE/source
60-
git clone git@github.com:ofiwg/libfabric.git
61-
git clone git@github.com:mercury-hpc/mercury.git --recursive
62-
git clone git@github.com:hpc-io/pdc.git
61+
git clone https://github.com/ofiwg/libfabric
62+
git clone https://github.com/mercury-hpc/mercury --recursive
63+
git clone https://github.com/hpc-io/pdc
6364
6465
export LIBFABRIC_SRC_DIR=$WORK_SPACE/source/libfabric
6566
export MERCURY_SRC_DIR=$WORK_SPACE/source/mercury
@@ -118,9 +119,18 @@ Install libfabric
118119
119120
120121
.. note::
122+
121123
``CC=mpicc`` may need to be changed to the corresponding compiler in your system, e.g. ``CC=cc`` or ``CC=gcc``.
122124
On Perlmutter@NERSC, ``--disable-efa --disable-sockets`` should be added to the ``./configure`` command when compiling on login nodes.
123125

126+
.. attention::
127+
128+
If you're installing PDC on MacOS, you need to make sure you enable ``sockets``:
129+
130+
.. code-block: Bash
131+
132+
./configure CFLAG=-O2 --enable-sockets=yes --enable-tcp=yes --enable-udp=yes --enable-rxm=yes
133+
124134
125135
Install Mercury
126136
---------------
@@ -149,6 +159,15 @@ Install Mercury
149159
``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``.
150160
Make sure the ctest passes. PDC may not work without passing all the tests of Mercury.
151161

162+
.. attention::
163+
164+
If you're installing PDC on MacOS, for the tests to work you need to specify the protocol used by Mercury:
165+
166+
.. code-block: Bash
167+
168+
cmake -DCMAKE_INSTALL_PREFIX=$MERCURY_DIR -DCMAKE_C_COMPILER=mpicc -DBUILD_SHARED_LIBS=ON \
169+
-DBUILD_TESTING=ON -DNA_USE_OFI=ON -DNA_USE_SM=OFF -DNA_OFI_TESTING_PROTOCOL=sockets
170+
152171
153172
Install PDC
154173
-----------
@@ -170,12 +189,21 @@ Install PDC
170189
echo 'export PATH=$PDC_DIR/include:$PDC_DIR/lib:$PATH' >> $WORK_SPACE/pdc_env.sh
171190
172191
.. note::
192+
173193
``-DCMAKE_C_COMPILER=mpicc -DMPI_RUN_CMD=mpiexec`` may need to be changed to ``-DCMAKE_C_COMPILER=cc -DMPI_RUN_CMD=srun`` depending on your system environment.
174194

175195
.. note::
176-
If you are trying to compile PDC on your Mac, ``LibUUID`` needs to be installed on your MacOS first. Simple use ``brew install ossp-uuid`` to install it.
196+
197+
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.
177198
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.
178199

200+
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:
201+
202+
.. code-block: Bash
203+
204+
export HG_TRANSPORT="sockets"
205+
206+
179207
Test Your PDC Installation
180208
--------------------------
181209
PDC's ``ctest`` contains both sequential and parallel/MPI tests, and can be run with the following in the `build` directory.
@@ -184,6 +212,12 @@ PDC's ``ctest`` contains both sequential and parallel/MPI tests, and can be run
184212
185213
ctest
186214
215+
You can also specify a timeout (e.g., 2 minutes) for the tests by specifying the ``timeout`` parameter when calling ``ctest``:
216+
217+
.. code-block:: Bash
218+
219+
ctest --timeout 120
220+
187221
.. note::
188222
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``
189223

src/api/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if(MERCURY_FOUND)
4242
set(PDC_EXT_INCLUDE_DEPENDENCIES ${MERCURY_INCLUDE_DIR}
4343
${PDC_EXT_INCLUDE_DEPENDENCIES}
4444
)
45-
set(PDC_EXT_LIB_DEPENDENCIES mercury ${PDC_EXT_LIB_DEPENDENCIES})
45+
set(PDC_EXT_LIB_DEPENDENCIES ${MERCURY_LIBRARIES} ${PDC_EXT_LIB_DEPENDENCIES})
4646
endif()
4747

4848
include_directories(${PDC_EXT_INCLUDE_DEPENDENCIES})

src/api/pdc_obj/pdc_cont.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PDCcont_create(const char *cont_name, pdcid_t cont_prop_id)
8686
p->cont_pt->pdc->local_id = cont_prop->pdc->local_id;
8787

8888
ret = PDC_Client_create_cont_id(cont_name, cont_prop_id, &(p->cont_info_pub->meta_id));
89+
8990
if (ret == FAIL)
9091
PGOTO_ERROR(0, "Unable to create container on the server!");
9192

@@ -316,8 +317,10 @@ PDC_cont_get_info(pdcid_t cont_id)
316317
FUNC_ENTER(NULL);
317318

318319
id_info = PDC_find_id(cont_id);
319-
info = (struct _pdc_cont_info *)(id_info->obj_ptr);
320+
if (id_info == NULL)
321+
PGOTO_ERROR(NULL, "cannot locate object");
320322

323+
info = (struct _pdc_cont_info *)(id_info->obj_ptr);
321324
ret_value = PDC_CALLOC(1, struct _pdc_cont_info);
322325
if (ret_value)
323326
memcpy(ret_value, info, sizeof(struct _pdc_cont_info));
@@ -326,9 +329,8 @@ PDC_cont_get_info(pdcid_t cont_id)
326329

327330
ret_value->cont_info_pub = PDC_CALLOC(1, struct pdc_cont_info);
328331
if (ret_value->cont_info_pub)
329-
memcpy(ret_value, info, sizeof(struct pdc_cont_info));
330-
else
331-
PGOTO_ERROR(NULL, "cannot allocate ret_value->cont_info_pub");
332+
memcpy(ret_value->cont_info_pub, info->cont_info_pub, sizeof(struct pdc_cont_info));
333+
332334
if (info->cont_info_pub->name)
333335
ret_value->cont_info_pub->name = strdup(info->cont_info_pub->name);
334336

src/server/pdc_server_metadata.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ PDC_Server_delete_metadata_by_id(metadata_delete_by_id_in_t *in, metadata_delete
969969
continue;
970970

971971
if (cont_entry->cont_id == target_obj_id) {
972-
hash_table_remove(container_hash_table_g, &pair.key);
972+
hash_table_remove(container_hash_table_g, pair.key);
973973
out->ret = 1;
974974
ret_value = SUCCEED;
975975
goto done;

src/tests/cont_del.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ main(int argc, char **argv)
8080
}
8181

8282
printf("trying to open a deleted container, should fail\n");
83-
cont = PDCcont_open("VPIC_cont", pdc);
83+
cont = PDCcont_open(cont_name, pdc);
8484
if (cont > 0)
8585
printf("Error: opened a container that was just deleted @ line %d!\n", __LINE__);
8686

0 commit comments

Comments
 (0)