Skip to content

Commit

Permalink
Remove toggling of TABLE from hh.mod (CoreNEURON + NMODL compatibilit…
Browse files Browse the repository at this point in the history
…y) (#3093)

- We were commenting TABLE statement from hh.mod as TABLE
  statement was not supported in mod2c.
- NMODL on CoreNEURON side supports TABLE statements also
  on GPU side.
- Hence, we can remove the CMake toggling logic for TABLE.
- Also update the references for tests in ringtest and testcorenrn repos

fixes #1764
  • Loading branch information
pramodk authored Sep 25, 2024
1 parent 3e45370 commit 93c7d2c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 233 deletions.
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,22 +747,17 @@ add_custom_target(
# =============================================================================
if(NRN_ENABLE_CORENEURON OR NRN_ENABLE_MOD_COMPATIBILITY)
set(GLOBAL_VAR_TOGGLE_COMMAND "'s/ GLOBAL minf/ RANGE minf/'")
set(TABLE_VAR_TOGGLE_COMMAND "'s/ TABLE minf/ :TABLE minf/'")
else()
set(GLOBAL_VAR_TOGGLE_COMMAND "'s/ RANGE minf/ GLOBAL minf/'")
set(TABLE_VAR_TOGGLE_COMMAND "'s/ :TABLE minf/ TABLE minf/'")
endif()
separate_arguments(GLOBAL_VAR_TOGGLE_COMMAND UNIX_COMMAND "${GLOBAL_VAR_TOGGLE_COMMAND}")
separate_arguments(TABLE_VAR_TOGGLE_COMMAND UNIX_COMMAND "${TABLE_VAR_TOGGLE_COMMAND}")
add_custom_target(
hh_update
COMMAND sed ${GLOBAL_VAR_TOGGLE_COMMAND} ${CMAKE_SOURCE_DIR}/src/nrnoc/hh.mod >
${CMAKE_BINARY_DIR}/hh.mod.1
COMMAND sed ${TABLE_VAR_TOGGLE_COMMAND} ${CMAKE_BINARY_DIR}/hh.mod.1 >
${CMAKE_BINARY_DIR}/hh.mod.2
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/hh.mod.2
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/hh.mod.1
${CMAKE_SOURCE_DIR}/src/nrnoc/hh.mod
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/hh.mod.1 ${CMAKE_BINARY_DIR}/hh.mod.2
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/hh.mod.1
COMMENT "Update hh.mod for CoreNEURON compatibility"
VERBATIM)
add_dependencies(nrniv_lib hh_update)
Expand Down
2 changes: 1 addition & 1 deletion src/coreneuron/mechanism/mech/modfile/hh.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ DERIVATIVE states {
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum, q10
: TABLE minf, mtau, hinf, htau, ninf, ntau DEPEND celsius FROM -100 TO 100 WITH 200
TABLE minf, mtau, hinf, htau, ninf, ntau DEPEND celsius FROM -100 TO 100 WITH 200

UNITSOFF
q10 = 3^((celsius - 6.3)/10)
Expand Down
6 changes: 1 addition & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ list(APPEND TESTS ringtest)
# Add small hoc test
# =============================================================================
set(HOCTEST_DIR ${PROJECT_SOURCE_DIR}/test/hoc_tests/connect_dend)
if(NRN_ENABLE_CORENEURON OR NRN_ENABLE_MOD_COMPATIBILITY)
set(REF_FILE cell3soma.core.dat.ref)
else()
set(REF_FILE cell3soma.dat.ref)
endif()
set(REF_FILE cell3soma.dat.ref)
add_test(
connect_dend
${CMAKE_COMMAND}
Expand Down
6 changes: 0 additions & 6 deletions test/api/hh_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ using std::endl;
using std::ofstream;

constexpr std::array<double, 3> EXPECTED_V{
#ifndef CORENEURON_ENABLED
-0x1.04p+6,
-0x1.b254ad82e20edp+5,
-0x1.24a52af1ab463p+6,
#else
-0x1.04p+6,
-0x1.b0c75635b5bdbp+5,
-0x1.24a84bedb7246p+6,
#endif
};

extern "C" void modl_reg(){/* No modl_reg */};
Expand Down
9 changes: 0 additions & 9 deletions test/api/netcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,12 @@ using std::endl;
using std::ofstream;

constexpr std::array<double, 6> EXPECTED_V{
#ifndef CORENEURON_ENABLED
-0x1.04p+6,
-0x1.085a63d029bc3p+6,
-0x1.112a5e95eb67cp+6,
-0x1.1795abaec26c1p+6,
-0x1.0422351f3f9dcp+6,
-0x1.03e5317ac368cp+6,
#else
-0x1.04p+6,
-0x1.085a703d657a7p+6,
-0x1.112d0039e9c38p+6,
-0x1.17974aa201b7bp+6,
-0x1.041fdf57a182bp+6,
-0x1.03e58fad20b92p+6,
#endif
};

extern "C" void modl_reg(){/* No modl_reg */};
Expand Down
4 changes: 2 additions & 2 deletions test/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ include(FetchContent)
FetchContent_Declare(
ringtest
GIT_REPOSITORY https://github.com/neuronsimulator/ringtest
GIT_TAG 4ede4751c68f72a9884c6af4f94f65ff638054a8
GIT_TAG 7d1aee72939f6dfcb2a14db4c7b00725d9e485fa
SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/tests/ringtest)

FetchContent_Declare(
testcorenrn
GIT_REPOSITORY https://github.com/neuronsimulator/testcorenrn
GIT_TAG 014aab9bee60a2bdd44b28a784c88092d2f6b92b
GIT_TAG e53831b3963af8be412e16807a85157e4413f307
SOURCE_DIR ${PROJECT_SOURCE_DIR}/external/tests/testcorenrn)

FetchContent_Declare(
Expand Down
203 changes: 0 additions & 203 deletions test/hoc_tests/connect_dend/cell3soma.core.dat.ref

This file was deleted.

0 comments on commit 93c7d2c

Please sign in to comment.