Skip to content

Commit

Permalink
add build option for adiak (#56)
Browse files Browse the repository at this point in the history
* add build option for adiak

* update github actions with adiak

* try job with adiak off

* add missing adiak guards

* also update run test WITH_ADIAK=Off
  • Loading branch information
slabasan authored Mar 8, 2024
1 parent 37ab3aa commit db88f2e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/containers/x86_64-broadwell-cuda11.6.1/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spack:
- flux-sched
- py-pika
- amqp-cpp +tcp
- adiak
view: local
concretizer:
unify: true
Expand Down Expand Up @@ -76,4 +77,6 @@ spack:
require: '@0.28'
py-pika:
require: '@1.3.1'
adiak:
require: '@0.4.0+shared+mpi'

3 changes: 3 additions & 0 deletions .github/containers/x86_64-broadwell-gcc11.2.1/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spack:
- flux-sched
- py-pika
- amqp-cpp +tcp
- adiak
view: local
concretizer:
unify: true
Expand Down Expand Up @@ -68,4 +69,6 @@ spack:
require: '@0.28'
py-pika:
require: '@1.3.1'
adiak:
require: '@0.4.0+shared+mpi'

8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
-DFAISS_DIR=$AMS_FAISS_PATH \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Run tests Torch=On FAISS=On HDF5=On AMS
Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
-DFAISS_DIR=$AMS_FAISS_PATH \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Run tests Torch=Off FAISS=On HDF5=On AMS
Expand Down Expand Up @@ -126,6 +128,7 @@ jobs:
-DWITH_TESTS=On \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Run tests Torch=Off FAISS=Off HDF5=On AMS
Expand Down Expand Up @@ -159,6 +162,7 @@ jobs:
-DWITH_TESTS=On \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=Off \
$GITHUB_WORKSPACE
make
- name: Run tests Torch=Off FAISS=Off HDF5=Off AMS
Expand Down Expand Up @@ -208,6 +212,7 @@ jobs:
-DFAISS_DIR=$AMS_FAISS_PATH \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Build Torch=Off FAISS=On HDF5=On AMS
Expand Down Expand Up @@ -242,6 +247,7 @@ jobs:
-DFAISS_DIR=$AMS_FAISS_PATH \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Build Torch=Off FAISS=Off HDF5=On AMS
Expand Down Expand Up @@ -274,6 +280,7 @@ jobs:
-DWITH_TESTS=On \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=On \
$GITHUB_WORKSPACE
make
- name: Build Torch=Off FAISS=Off HDF5=Off AMS
Expand Down Expand Up @@ -303,5 +310,6 @@ jobs:
-DWITH_TESTS=On \
-DWITH_AMS_DEBUG=On \
-DWITH_WORKFLOW=On \
-DWITH_ADIAK=Off \
$GITHUB_WORKSPACE
make
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ option(WITH_AMS_DEBUG "Enable verbose messages" OFF)
option(WITH_PERFFLOWASPECT "Use PerfFlowAspect for Profiling" OFF)
option(WITH_WORKFLOW "Install python drivers used by the outer workflow" OFF)
option(WITH_AMS_LIB "Install C++ library to support scientific applications" ON)
option(WITH_ADIAK "Use Adiak for recording metadata" OFF)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

if (WITH_MPI)
Expand Down Expand Up @@ -308,6 +309,13 @@ if (WITH_EXAMPLES)
list(APPEND AMS_EXAMPLE_DEFINES "-D__ENABLE_PERFFLOWASPECT__")
endif()

if (WITH_ADIAK)
find_package(adiak REQUIRED)
list(APPEND AMS_EXAMPLE_DEFINES "-D__ENABLE_ADIAK__")
list(APPEND AMS_EXAMPLE_INCLUDES ${adiak_INCLUDE_DIR})
list(APPEND AMS_EXAMPLE_LIBRARIES adiak::adiak)
endif()

add_subdirectory(examples)
endif()
endif()
Expand Down
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AMSLib depends on the following packages:
* REDIS (Optional)
* HDF5 (Optional)
* CUDA (Optional)
* ADIAK (Optional)

## Spack Installation

Expand Down
33 changes: 33 additions & 0 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#ifdef __AMS_ENABLE_ADIAK__
#include <adiak.hpp>
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
Expand Down Expand Up @@ -642,6 +645,30 @@ int main(int argc, char **argv)

bool verbose = false;

#ifdef __AMS_ENABLE_ADIAK__
// add adiak init here
adiak::init(NULL);

// replace with adiak::collect_all(); once adiak v0.4.0
adiak::uid();
adiak::launchdate();
adiak::launchday();
adiak::executable();
adiak::executablepath();
adiak::workdir();
adiak::libraries();
adiak::cmdline();
adiak::hostname();
adiak::clustername();
adiak::walltime();
adiak::systime();
adiak::cputime();
adiak::jobsize();
adiak::hostlist();
adiak::numhosts();
adiak::value("compiler", std::string("@RAJAPERF_COMPILER@"));
#endif

// -------------------------------------------------------------------------
// setup command line parser
// -------------------------------------------------------------------------
Expand Down Expand Up @@ -876,6 +903,12 @@ int main(int argc, char **argv)
return -1;
}

// ---------------------------------------------------------------------------
#ifdef __AMS_ENABLE_ADIAK__
// adiak finalize
adiak::fini();
#endif

MPI_CALL(MPI_Finalize());
return ret;
}

0 comments on commit db88f2e

Please sign in to comment.