Skip to content

Commit

Permalink
Patched caar_compute changes from E3SM-Project/E3SM#6522.
Browse files Browse the repository at this point in the history
  • Loading branch information
trey-ornl committed Oct 3, 2024
1 parent a269ef9 commit 5bbadb7
Show file tree
Hide file tree
Showing 13 changed files with 1,052 additions and 78 deletions.
6 changes: 0 additions & 6 deletions components/eamxx/cmake/machine-files/crusher-scream-cpu.cmake

This file was deleted.

17 changes: 0 additions & 17 deletions components/eamxx/cmake/machine-files/crusher-scream-gpu.cmake

This file was deleted.

55 changes: 55 additions & 0 deletions components/homme/cmake/machineFiles/frontier.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SET (HOMME_MACHINE "frontier" CACHE STRING "")

SET (HOMMEXX_CUDA_MAX_WARP_PER_TEAM "16" CACHE STRING "")

SET (NETCDF_DIR $ENV{CRAY_NETCDF_HDF5PARALLEL_PREFIX} CACHE FILEPATH "")
SET (HDF5_DIR $ENV{CRAY_HDF5_PARALLEL_PREFIX} CACHE FILEPATH "")
SET (CPRNC_DIR /ccs/proj/cli115/software/frontier/cprnc CACHE FILEPATH "")

SET(BUILD_HOMME_WITHOUT_PIOLIBRARY TRUE CACHE BOOL "")

SET(HOMME_FIND_BLASLAPACK TRUE CACHE BOOL "")

SET(WITH_PNETCDF FALSE CACHE FILEPATH "")

SET(USE_QUEUING FALSE CACHE BOOL "")

SET(BUILD_HOMME_PREQX_KOKKOS TRUE CACHE BOOL "")
SET(BUILD_HOMME_THETA_KOKKOS TRUE CACHE BOOL "")

SET (HOMMEXX_BFB_TESTING FALSE CACHE BOOL "")

SET(USE_TRILINOS OFF CACHE BOOL "")

SET(HIP_BUILD TRUE CACHE BOOL "")

SET(Kokkos_ENABLE_SERIAL ON CACHE BOOL "")
SET(Kokkos_ENABLE_DEBUG OFF CACHE BOOL "")
SET(Kokkos_ARCH_VEGA90A ON CACHE BOOL "")
SET(Kokkos_ENABLE_OPENMP OFF CACHE BOOL "")
SET(Kokkos_ENABLE_HIP ON CACHE BOOL "")
SET(Kokkos_ENABLE_EXPLICIT_INSTANTIATION OFF CACHE BOOL "")

SET(CMAKE_C_COMPILER "cc" CACHE STRING "")
SET(CMAKE_Fortran_COMPILER "ftn" CACHE STRING "")
#SET(CMAKE_Fortran_FLAGS "--gcc-toolchain=$ENV{MEMBERWORK}/cli115/workaround" CACHE STRING "")
SET(CMAKE_CXX_COMPILER "hipcc" CACHE STRING "")

SET(Extrae_LIBRARY "-I$ENV{CRAY_MPICH_DIR}/include -L$ENV{CRAY_MPICH_DIR}/lib -lmpi $ENV{PE_MPICH_GTL_DIR_amd_gfx90a} $ENV{PE_MPICH_GTL_LIBS_amd_gfx90a}" CACHE STRING "")

#SET(ADD_Fortran_FLAGS "-G2 --gcc-toolchain=$ENV{MEMBERWORK}/cli115/workaround ${Extrae_LIBRARY}" CACHE STRING "")
SET(ADD_C_FLAGS "-g -O ${Extrae_LIBRARY}" CACHE STRING "")
SET(ADD_CXX_FLAGS "-g -std=c++14 -O3 -munsafe-fp-atomics --offload-arch=gfx90a -fno-gpu-rdc -Wno-unused-command-line-argument -Wno-unsupported-floating-point-opt -Wno-#pragma-messages ${Extrae_LIBRARY}" CACHE STRING "")
SET(ADD_LINKER_FLAGS "${Extrae_LIBRARY}" CACHE STRING "")


set (ENABLE_OPENMP OFF CACHE BOOL "")
set (ENABLE_COLUMN_OPENMP OFF CACHE BOOL "")
set (ENABLE_HORIZ_OPENMP OFF CACHE BOOL "")

set (HOMME_TESTING_PROFILE "short" CACHE STRING "")
SET (BUILD_HOMME_THETA_KOKKOS TRUE CACHE BOOL "")

set (USE_NUM_PROCS 8 CACHE STRING "")

SET (USE_MPI_OPTIONS "-c7 --gpu-bind=closest --gpus-per-task=1" CACHE FILEPATH "")
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,8 @@ class HyperviscosityFunctorImpl
SphereOperators m_sphere_ops;

// Policies
#ifndef NDEBUG
template<typename Tag>
using TeamPolicyType = Kokkos::TeamPolicy<ExecSpace,Kokkos::LaunchBounds<512,1>,Tag>;
#else
template<typename Tag>
using TeamPolicyType = Kokkos::TeamPolicy<ExecSpace,Tag>;
#endif
Kokkos::RangePolicy<ExecSpace,TagUpdateStates> m_policy_update_states;
TeamPolicyType<TagFirstLaplaceHV> m_policy_first_laplace;
TeamPolicyType<TagHyperPreExchange> m_policy_pre_exchange;
Expand Down
2 changes: 1 addition & 1 deletion components/homme/src/share/compose/compose_homme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ struct HommeFormatArray {
std::vector<T*> ie_data_ptr;
const Int nlev, qsized, ntimelev;

#ifdef COMPOSE_ENABLE_GPU
#if defined __CUDA_ARCH__ || defined __HIP_DEVICE_COMPILE__
COMPOSE_INLINE_FUNCTION static T& unused () {
static T unused = 0;
assert(0);
Expand Down
28 changes: 2 additions & 26 deletions components/homme/src/share/cxx/ExecSpaceDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <cassert>

#include <sstream>
#include <vector>

#include "ExecSpaceDefs.hpp"
Expand Down Expand Up @@ -35,32 +34,9 @@ void initialize_kokkos () {
// provides, as that algorithm is hardcoded in Kokkos::initialize(int& narg,
// char* arg[]). Once the behavior is exposed in the InitArguments version of
// initialize, we can remove this string code.
// If for some reason we're running on a GPU platform, have Cuda enabled,
// but are using a different execution space, this initialization is still
// OK. The rank gets a GPU assigned and simply will ignore it.
#ifdef KOKKOS_ENABLE_CUDA
int nd;
const auto ret = cudaGetDeviceCount(&nd);
if (ret != cudaSuccess) {
// It isn't a big deal if we can't get the device count.
nd = 1;
}
#elif defined(KOKKOS_ENABLE_HIP)
int nd;
const auto ret = hipGetDeviceCount(&nd);
if (ret != hipSuccess) {
// It isn't a big deal if we can't get the device count.
nd = 1;
}
#endif
#ifdef HOMMEXX_ENABLE_GPU
std::stringstream ss;
ss << "--kokkos-num-devices=" << nd;
const auto key = ss.str();
std::vector<char> str(key.size()+1);
std::copy(key.begin(), key.end(), str.begin());
str.back() = 0;
args.push_back(const_cast<char*>(str.data()));
const char *const map_device = "--kokkos-map-device-id-by=mpi_rank";
args.push_back(const_cast<char*>(map_device));
#endif


Expand Down
Loading

0 comments on commit 5bbadb7

Please sign in to comment.