Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes the build system to CMake #56

Merged
merged 24 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f697f49
Initial work on converting DYAD from autotools to CMake
ilumsden Nov 12, 2023
8adab39
Updates compile_test.yaml to use CMake instead of Autotools
ilumsden Nov 20, 2023
51194ce
Typo fix
ilumsden Nov 20, 2023
25504e5
Removes "VERSION" from find_package since it's not actually correct
ilumsden Nov 20, 2023
a563f9f
refactored and initial changes to build.
hariharan-devarajan Nov 23, 2023
d166da2
fixes for installation.
hariharan-devarajan Nov 23, 2023
ef5b3e8
fixed streaming apis.
hariharan-devarajan Nov 23, 2023
b77a3b5
fixed installation script.
hariharan-devarajan Nov 23, 2023
987ffd2
fixed CI
hariharan-devarajan Nov 23, 2023
f8bb92e
fixed CI
hariharan-devarajan Nov 23, 2023
b9a5311
fix ucx compile
hariharan-devarajan Nov 23, 2023
06da6ea
fix ci
hariharan-devarajan Nov 23, 2023
1619e2f
separate setup of spack
hariharan-devarajan Dec 1, 2023
7603a03
fix comments
hariharan-devarajan Dec 1, 2023
d0f63d3
fixed spack script
hariharan-devarajan Dec 1, 2023
e373223
fixed python
hariharan-devarajan Dec 1, 2023
46a6179
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
7349c59
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
179e18d
Update compile_test.yaml
hariharan-devarajan Dec 1, 2023
c7d739c
Changes to public header and libnames
hariharan-devarajan Dec 15, 2023
6c8b5f5
remove variables which prevent cmakr_install.cmake to use CMAKE_INSTA…
hariharan-devarajan Jan 16, 2024
3fa60de
Merge branch 'main' of github.com:flux-framework/dyad into cmake_refa…
hariharan-devarajan Jan 16, 2024
069b01f
fixed typo
hariharan-devarajan Jan 17, 2024
e0b5d6a
changed c99 to c11
hariharan-devarajan Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/prod-cons/dyad_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export DYAD_PATH_CONSUMER=${DYAD_PATH}_consumer
mkdir -p ${DYAD_PATH_CONSUMER}

if [[ "$mode" == "${valid_modes[0]}" ]]; then
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/dyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_cons 10 $DYAD_PATH_CONSUMER
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/libdyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_cons 10 $DYAD_PATH_CONSUMER
elif [[ "$mode" == "${valid_modes[1]}" ]]; then
${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_cons 10 $DYAD_PATH_CONSUMER
elif [[ "$mode" == "${valid_modes[2]}" ]]; then
python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_CONSUMER 10 50
else
echo "Invalid test mode: $mode"
echo "Invalid cons test mode: $mode"
exit 1
fi
8 changes: 4 additions & 4 deletions .github/prod-cons/dyad_producer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ flux module load ${DYAD_INSTALL_PREFIX}/lib/dyad.so $DYAD_PATH_PRODUCER $DYAD_D

if [[ "$mode" == "${valid_modes[0]}" ]]; then
echo ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/dyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${test_modes[1]}" ]]; then
LD_PRELOAD=${DYAD_INSTALL_PREFIX}/lib/libdyad_wrapper.so ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/c_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${valid_modes[1]}" ]]; then
echo ${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_prod 10 $DYAD_PATH_PRODUCER
${GITHUB_WORKSPACE}/docs/demos/ecp_feb_2023/cpp_prod 10 $DYAD_PATH_PRODUCER
elif [[ "$mode" == "${test_modes[2]}" ]]; then
elif [[ "$mode" == "${valid_modes[2]}" ]]; then
echo python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_PRODUCER 10 50
python3 ${GITHUB_WORKSPACE}/tests/pydyad_spsc/consumer.py $DYAD_PATH_PRODUCER 10 50
else
echo "Invalid test mode: $mode"
echo "Invalid prod test mode: $mode"
exit 1
fi
5 changes: 3 additions & 2 deletions .github/prod-cons/prod_cons_argparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if test "$#" -ne 1; then
fi

mode="$1"

echo "Need mode: $mode"
valid_modes=("c" "cpp" "python")
mode_is_valid=0
for vm in "${valid_modes[@]}"; do
Expand All @@ -18,8 +18,9 @@ for vm in "${valid_modes[@]}"; do
mode_is_valid=0
fi
done
echo "Need valid_modes: $mode_is_valid"

if [[ $mode_is_valid -eq 0 ]]; then
echo "Invalid mode: $mode"
echo "Invalid arg mode: $mode"
exit 2
fi
136 changes: 136 additions & 0 deletions .github/setup/setup_spack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
. ${SPACK_DIR}/share/spack/setup-env.sh
#PYTHON_VERSION=`python --version | awk {'print $2'}`
#sudo rm /usr/bin/python
#sudo ln -s `which python3.10` /usr/bin/python
mkdir -p $HOME/.spack
cat > $HOME/.spack/packages.yaml << EOF
packages:
all:
target: [x86_64]
providers:
mpi: [openmpi]
python:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
py-jsonschema:
buildable: False
externals:
- spec: "[email protected]"
prefix: /usr
py-cffi:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
py-ply:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
py-pyyaml:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
czmq:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
sqlite:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
libzmq:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
lua:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
lua-luaposix:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
lz4:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
ncurses:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
pkgconf:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
hwloc:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
libarchive:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
autoconf:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
automake:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
libtool:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
m4:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
openmpi:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
openssl:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
pkg-config:
buildable: False
externals:
- spec: [email protected]
prefix: /usr
EOF
spack external find
spack spec flux-core@${FLUX_VERSION}
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
spack spec [email protected]
fi
spack install -j4 flux-core@${FLUX_VERSION}
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
spack install -j4 [email protected]
fi
mkdir -p ${DYAD_INSTALL_PREFIX}
spack view --verbose symlink ${DYAD_INSTALL_PREFIX} flux-core@${FLUX_VERSION}
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
spack view --verbose symlink ${DYAD_INSTALL_PREFIX} [email protected]
fi
17 changes: 8 additions & 9 deletions .github/workflows/compile_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,14 @@ jobs:
cd ${GITHUB_WORKSPACE}
ls
pwd
./autogen.sh
CONFIGURE_FLAGS=""
mkdir build
cd build
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DYAD_INSTALL_PREFIX}/lib/pkgconfig
CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=FLUX_RPC -DDYAD_PROFILER=NONE"
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
CONFIGURE_FLAGS=" --enable-ucx "
CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=UCX -DDYAD_PROFILER=NONE"
fi
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DYAD_INSTALL_PREFIX}/lib/pkgconfig
./configure --enable-dyad-debug ${CONFIGURE_FLAGS} --prefix=${DYAD_INSTALL_PREFIX} \
CFLAGS="-I${DYAD_INSTALL_PREFIX}/include" \
CXXFLAGS="-I${DYAD_INSTALL_PREFIX}/include" \
LDFLAGS="-L${DYAD_INSTALL_PREFIX}/lib"
cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} -DENABLE_DYAD_DEBUG=ON ..
make install -j
- name: Install PyDYAD
run: |
Expand All @@ -222,6 +220,7 @@ jobs:
- name: Install Test
run: |
. ${SPACK_DIR}/share/spack/setup-env.sh
export LD_LIBRARY_PATH=${DYAD_INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}
export CFLAGS="-I${DYAD_INSTALL_PREFIX}/include"
export CXXFLAGS="-I${DYAD_INSTALL_PREFIX}/include"
export LDFLAGS="-L${DYAD_INSTALL_PREFIX}/lib"
Expand Down Expand Up @@ -262,4 +261,4 @@ jobs:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${DYAD_INSTALL_PREFIX}/lib
echo "Starting flux brokers"
flux start --test-size=2 /bin/bash ${GITHUB_WORKSPACE}/.github/prod-cons/dyad_prod_cons_test.sh "python"

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ flux_barrier
**/__pycache__/
**/build
**/*.egg-info
/install/
/dyad-env/
48 changes: 48 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- name: Install Dependencies
before: >
sudo rm -rf /home/gitpod/.pyenv &&
sudo apt-get update &&
sudo apt-get install -y --no-install-recommends gcc g++ gfortran autoconf \
automake libtool libtool-bin openmpi-bin libopenmpi-dev libarchive-dev \
ncurses-bin hwloc lua5.3 liblua5.3-dev python3.10 python3-pip python3.10-dev liblz4-dev libczmq-dev lua-posix-dev \
lz4 pkgconf libzmq5 sqlite
command: >
sudo python3.10 -m pip install jsonschema>=2.3.0 cffi ply pyyaml &&
gp sync-done sys
- name: Install spack
init: gp sync-await sys
command: >
mkdir /workspace/scripts &&
echo export SPACK_DIR=/workspace/spack > /workspace/scripts/gitpod.env &&
echo export FLUX_VERSION=0.54 >> /workspace/scripts/gitpod.env &&
echo export DYAD_DTL_MODE=UCX >> /workspace/scripts/gitpod.env &&
echo export DYAD_INSTALL_PREFIX=/workspace/install >> /workspace/scripts/gitpod.env &&
source /workspace/scripts/gitpod.env &&
git clone https://github.com/spack/spack.git ${SPACK_DIR} &&
source /workspace/dyad/.github/setup/setup_spack.sh &&
gp sync-done spack
- name: Compile DYAD
init: gp sync-await spack
command: >
source /workspace/scripts/gitpod.env &&
. ${SPACK_DIR}/share/spack/setup-env.sh &&
echo "Install DYAD" &&
cd /workspace/dyad &&
mkdir build &&
cd build &&
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${DYAD_INSTALL_PREFIX}/lib/pkgconfig &&
CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=FLUX_RPC -DDYAD_PROFILER=NONE" &&
if [[ $DYAD_DTL_MODE == 'UCX' ]]; then
CONFIGURE_FLAGS="-DDYAD_CONTROL_PLANE=FLUX_RPC -DDYAD_DATA_PLANE=UCX -DDYAD_PROFILER=NONE"
fi
cmake -DCMAKE_INSTALL_PREFIX=${DYAD_INSTALL_PREFIX} ${CONFIGURE_FLAGS} -DENABLE_DYAD_DEBUG=ON .. &&
make install -j


11 changes: 11 additions & 0 deletions CMake/dyad-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#-----------------------------------------------------------------------------
# Version file for install directory
#-----------------------------------------------------------------------------
set(PACKAGE_VERSION @DYAD_PACKAGE_VERSION@)

if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @DYAD_VERSION_MAJOR@)
set(PACKAGE_VERSION_COMPATIBLE 1)
if ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @DYAD_VERSION_PATCH@)
set(PACKAGE_VERSION_EXACT 1)
endif ()
endif ()
23 changes: 23 additions & 0 deletions CMake/dyad-config.cmake.build.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set(DYAD_FOUND TRUE)

# Include directories
set(DYAD_INCLUDE_DIRS "@CMAKE_INCLUDE_OUTPUT_DIRECTORY@")
if (NOT IS_DIRECTORY "${DYAD_INCLUDE_DIRS}")
set(DYAD_FOUND FALSE)
endif ()
#message(STATUS "DYAD_INCLUDE_DIRS: " ${DYAD_INCLUDE_DIRS})
get_filename_component(DYAD_ROOT_DIR ${DYAD_INCLUDE_DIRS}/.. ABSOLUTE)
#message(STATUS "DYAD_ROOT_DIR: " ${DYAD_ROOT_DIR})
set(DYAD_LIBRARY_PATH "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
#message(STATUS "DYAD_LIBRARY_PATH: " ${DYAD_LIBRARY_PATH})
link_directories(${DYAD_LIBRARY_PATH})
set(DYAD_LIBRARIES dyad)
set(DYAD_DEFINITIONS "")
hariharan-devarajan marked this conversation as resolved.
Show resolved Hide resolved
add_library(dyad INTERFACE)
add_library(dyad::dyad ALIAS dyad)
target_include_directories(dyad INTERFACE ${DYAD_INCLUDE_DIRS})
target_link_libraries(dyad INTERFACE ${DYAD_LIBRARIES})
target_compile_options(dyad INTERFACE ${DYAD_DEFINITIONS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dyad
REQUIRED_VARS DYAD_FOUND DYAD_INCLUDE_DIRS DYAD_LIBRARY_PATH DYAD_LIBRARIES)
22 changes: 22 additions & 0 deletions CMake/dyad-config.cmake.install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set(DYAD_FOUND TRUE)

# Include directories
set(DYAD_INCLUDE_DIRS "@DYAD_INSTALL_INCLUDE_DIR@")
if (NOT IS_DIRECTORY "${DYAD_INCLUDE_DIRS}")
set(DYAD_FOUND FALSE)
endif ()
#message(STATUS "DYAD_INCLUDE_DIRS: " ${DYAD_INCLUDE_DIRS})
get_filename_component(DYAD_ROOT_DIR ${DYAD_INCLUDE_DIRS}/.. ABSOLUTE)
#message(STATUS "DYAD_ROOT_DIR: " ${DYAD_ROOT_DIR})
set(DYAD_LIBRARY_PATH "@DYAD_INSTALL_LIB_DIR@")
link_directories(${DYAD_LIBRARY_PATH})
set(DYAD_LIBRARIES dyad)
set(DYAD_DEFINITIONS "")
Copy link
Collaborator

@hariharan-devarajan hariharan-devarajan Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add alias.
set(DYAD_DEFINITIONS "")
add_library(dyad INTERFACE)
add_library(dyad::dyad ALIAS dyad)
target_include_directories(dyad INTERFACE ${DYAD_INCLUDE_DIRS})
target_link_libraries(dyad INTERFACE ${DYAD_LIBRARIES})
target_compile_options(dyad INTERFACE ${DYAD_DEFINITIONS})

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXED

add_library(dyad INTERFACE)
add_library(dyad::dyad ALIAS dyad)
target_include_directories(dyad INTERFACE ${DYAD_INCLUDE_DIRS})
target_link_libraries(dyad INTERFACE ${DYAD_LIBRARIES})
target_compile_options(dyad INTERFACE ${DYAD_DEFINITIONS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(dyad
REQUIRED_VARS DYAD_FOUND DYAD_INCLUDE_DIRS DYAD_LIBRARIES)
Loading