DYSJZWZUGJ7ZNEI7WL5FHS2TDM7LQA7HEEUHGV7EJJRF3TYENNCAC
Cactus Code Thorn Kokkos
Author(s) : Erik Schnetter
Maintainer(s): Cactus team
Licence : ?
--------------------------------------------------------------------------
1. Purpose
Configure the Kokkos library; see <https://github.com/kokkos/kokkos>
From the web site:
Kokkos C++ Performance Portability Programming EcoSystem: The
Programming Model -- Parallel Execution and Memory Abstraction
Kokkos Core implements a programming model in C++ for writing
performance portable applications targeting all major HPC platforms.
For that purpose it provides abstractions for both parallel execution
of code and data management. Kokkos is designed to target complex node
architectures with N-level memory hierarchies and multiple types of
execution resources. It currently can use OpenMP, Pthreads and CUDA as
backend programming models.
# Configuration definitions for thorn Kokkos
PROVIDES Kokkos
{
SCRIPT configure.sh
LANG bash
OPTIONS KOKKOS_DIR
}
REQUIRES Kokkos
#! /bin/bash
################################################################################
# Prepare
################################################################################
# Set up shell
if [ "$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')" = 'yes' ]; then
set -x # Output commands
fi
set -e # Abort on errors
################################################################################
# Configure Cactus
################################################################################
if [ -z "${KOKKOS_DIR}" ]; then
echo "BEGIN ERROR"
echo "Configuration variable KOKKOS_DIR is not set"
echo "END ERROR"
exit 1
fi
# Set options
: ${KOKKOS_INC_DIRS="${KOKKOS_DIR}/include"}
: ${KOKKOS_LIB_DIRS="${KOKKOS_DIR}/lib"}
: ${KOKKOS_LIBS="kokkos"}
KOKKOS_INC_DIRS="$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${KOKKOS_INC_DIRS})"
KOKKOS_LIB_DIRS="$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${KOKKOS_LIB_DIRS})"
echo "BEGIN MAKE_DEFINITION"
echo "KOKKOS_DIR = ${KOKKOS_DIR}"
echo "KOKKOS_INC_DIRS = ${KOKKOS_INC_DIRS}"
echo "KOKKOS_LIB_DIRS = ${KOKKOS_LIB_DIRS}"
echo "KOKKOS_LIBS = ${KOKKOS_LIBS}"
echo "END MAKE_DEFINITION"
echo 'INCLUDE_DIRECTORY $(KOKKOS_INC_DIRS)'
echo 'LIBRARY_DIRECTORY $(KOKKOS_LIB_DIRS)'
echo 'LIBRARY $(KOKKOS_LIBS)'
# Interface definition for thorn Kokkos
IMPLEMENTS: Kokkos
# Parameter definitions for thorn Kokkos
# Schedule definitions for thorn Kokkos
SCHEDULE Kokkos_Startup AT startup AFTER Driver_Startup
{
LANG: C
} "Initialize Kokkos"
SCHEDULE Kokkos_Shutdown AT shutdown BEFORE Driver_Shutdown
{
LANG: C
OPTIONS: meta
} "Finalize Kokkos"
#include <cctk.h>
#include <cctk_Arguments.h>
#include <Kokkos_Core.hpp>
extern "C" int Kokkos_Startup() {
int argc = 0;
char *argv[] = {nullptr};
Kokkos::initialize(argc, argv);
return 0;
}
extern "C" int Kokkos_Shutdown() {
Kokkos::finalize();
return 0;
}
# Main make.code.defn file for thorn Kokkos
# Source files in this directory
SRCS = kokkos.cxx
# Subdirectories containing source files
SUBDIRS =