Skip to content

Commit

Permalink
Remove usage of -DDISABLE_OPENACC (GPU build simplification) (#2653)
Browse files Browse the repository at this point in the history
* Remove usage of -DDISABLE_OPENACC (GPU build simplification)
- always use Random123 via unified memory support
- some of the cpp files were avoided it via `-DDISABLE_OPENACC`
  but with the addition of RANDOM construct, the Random123 streams
  are allocated during model setup. So it's better to do this
  in one way unless there is performance degradation.
* update nmodl as well : BlueBrain/nmodl/pull/1133
  • Loading branch information
pramodk committed Jan 27, 2024
1 parent 638c30c commit c1e245d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
2 changes: 1 addition & 1 deletion external/nmodl
Submodule nmodl updated 41 files
+14 −1 .github/workflows/nmodl-ci.yml
+4 −0 .gitignore
+1 −1 .sanitizers/undefined.supp
+9 −2 CMakeLists.txt
+9 −0 codecov.yaml
+1 −1 ext/fmt
+1 −1 ext/spdlog
+1 −0 setup.py
+2 −0 src/codegen/CMakeLists.txt
+3 −12 src/codegen/codegen_acc_visitor.cpp
+4 −4 src/codegen/codegen_acc_visitor.hpp
+3,768 −0 src/codegen/codegen_coreneuron_cpp_visitor.cpp
+1,279 −0 src/codegen/codegen_coreneuron_cpp_visitor.hpp
+452 −4,209 src/codegen/codegen_cpp_visitor.cpp
+423 −1,063 src/codegen/codegen_cpp_visitor.hpp
+4 −0 src/codegen/codegen_info.hpp
+7 −1 src/codegen/codegen_naming.hpp
+957 −0 src/codegen/codegen_neuron_cpp_visitor.cpp
+678 −0 src/codegen/codegen_neuron_cpp_visitor.hpp
+1 −0 src/language/node_info.py
+5 −1 src/language/nodes.py
+1 −1 src/language/templates/ast/ast.cpp
+1 −1 src/language/templates/ast/ast.hpp
+2 −2 src/language/templates/pybind/pyast.hpp
+4 −0 src/language/templates/visitors/nmodl_visitor.cpp
+8 −4 src/language/templates/visitors/nmodl_visitor.hpp
+38 −13 src/main.cpp
+1 −1 src/utils/common_utils.hpp
+7 −2 test/unit/CMakeLists.txt
+30 −28 test/unit/codegen/codegen_coreneuron_cpp_visitor.cpp
+271 −0 test/unit/codegen/codegen_neuron_cpp_visitor.cpp
+1 −2 test/unit/utils/nmodl_constructs.cpp
+11 −10 test/unit/visitor/sympy_solver.cpp
+7 −0 test/usecases/CMakeLists.txt
+30 −0 test/usecases/cnexp_array/leonhard.mod
+27 −0 test/usecases/cnexp_array/simulate.py
+16 −0 test/usecases/cnexp_scalar/leonhard.mod
+27 −0 test/usecases/cnexp_scalar/simulate.py
+20 −0 test/usecases/global_breakpoint/leonhard.mod
+27 −0 test/usecases/global_breakpoint/simulate.py
+20 −0 test/usecases/run_test.sh
16 changes: 0 additions & 16 deletions src/coreneuron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -406,22 +406,6 @@ set(CORENEURON_BUILTIN_MODFILES
# coreneuron GPU library
# =============================================================================
if(CORENRN_ENABLE_GPU)
# ~~~
# artificial cells and some other cpp files (using Random123) should be compiled
# without OpenACC to avoid use of GPU Random123 streams
# OL210813: this shouldn't be needed anymore, but it may have a small performance benefit
# ~~~
set(OPENACC_EXCLUDED_FILES
${CMAKE_CURRENT_BINARY_DIR}/netstim.cpp
${CMAKE_CURRENT_BINARY_DIR}/netstim_inhpoisson.cpp
${CMAKE_CURRENT_BINARY_DIR}/pattern.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/nrn_setup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/setup_fornetcon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/corenrn_data_return.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/global_vars.cpp)

set_source_files_properties(${OPENACC_EXCLUDED_FILES} PROPERTIES COMPILE_FLAGS
"-DDISABLE_OPENACC")
# Only compile the explicit CUDA implementation of the Hines solver in GPU builds. Because of
# https://forums.developer.nvidia.com/t/cannot-dynamically-load-a-shared-library-containing-both-openacc-and-cuda-code/210972
# this cannot be included in the same shared library as the rest of the OpenACC code.
Expand Down
5 changes: 1 addition & 4 deletions src/coreneuron/utils/randoms/nrnran123.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ of the full distribution available from

#include <cmath>

// Some files are compiled with DISABLE_OPENACC, and some builds have no GPU
// support at all. In these two cases, request that the random123 state is
// allocated using new/delete instead of CUDA unified memory.
#if defined(CORENEURON_ENABLE_GPU) && !defined(DISABLE_OPENACC)
#if defined(CORENEURON_ENABLE_GPU)
#define CORENRN_RAN123_USE_UNIFIED_MEMORY true
#else
#define CORENRN_RAN123_USE_UNIFIED_MEMORY false
Expand Down

0 comments on commit c1e245d

Please sign in to comment.