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

Fixes for HIP + OpenMP Compilation and Ault Testing Env #1578

Merged
merged 3 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions cmake/public/gridtools_setup_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,17 @@ macro(_gt_setup_targets _config_mode clang_cuda_mode)
_gt_add_library(${_config_mode} layout_transformation_cpu)
target_link_libraries(${_gt_namespace}layout_transformation_cpu INTERFACE ${_gt_namespace}gridtools OpenMP::OpenMP_CXX)

if(GT_CUDA_TYPE STREQUAL HIPCC-AMDGPU)
# workaround for undefind _OPENMP in HIP device code even when OpenMP is enabled
target_compile_definitions(${_gt_namespace}stencil_cpu_kfirst INTERFACE -DGT_HIP_OPENMP_WORKAROUND)
target_compile_definitions(${_gt_namespace}stencil_cpu_ifirst INTERFACE -DGT_HIP_OPENMP_WORKAROUND)
if(MPI_CXX_FOUND)
target_compile_definitions(${_gt_namespace}gcl_cpu INTERFACE -DGT_HIP_OPENMP_WORKAROUND)
endif()
target_compile_definitions(${_gt_namespace}boundaries_cpu INTERFACE -DGT_HIP_OPENMP_WORKAROUND)
target_compile_definitions(${_gt_namespace}layout_transformation_cpu INTERFACE -DGT_HIP_OPENMP_WORKAROUND)
endif()

list(APPEND GT_GCL_ARCHS cpu)

list(APPEND GT_STENCILS cpu_kfirst cpu_ifirst)
Expand Down
4 changes: 2 additions & 2 deletions include/gridtools/thread_pool/omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

#pragma once

#ifdef _OPENMP
#if defined(_OPENMP) || defined(GT_HIP_OPENMP_WORKAROUND)
#include <omp.h>
#endif

namespace gridtools {
namespace thread_pool {
struct omp {
#ifdef _OPENMP
#if defined(_OPENMP) || defined(GT_HIP_OPENMP_WORKAROUND)
friend auto thread_pool_get_thread_num(omp) { return omp_get_thread_num(); }
friend auto thread_pool_get_max_threads(omp) { return omp_get_max_threads(); }

Expand Down
10 changes: 5 additions & 5 deletions jenkins/envs/ault_hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

source $(dirname "$BASH_SOURCE")/ault.sh

module use /users/fthaler/public/jenkins/modules
module load gcc/8.3.0
module load cuda/10.1
module load hip-clang/2020-04-28
module load rocm/3.8.0
# fix for broken module
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/rocm-3.8.0/llvm/lib"
module load gcc/10.1.0

export CXX=$(which hipcc)
export CC=$(which gcc)
export FC=$(which gfortran)

export GTRUN_BUILD_COMMAND='srun -w ault20 --time=01:00:00 make -j 64'
export GTRUN_BUILD_COMMAND='srun -w ault20 --time=03:00:00 make -j 64'
export GTRUN_SBATCH_NTASKS=1
export GTRUN_SBATCH_CPUS_PER_TASK=128
export GTRUN_SBATCH_MEM_BIND=local
Expand Down