CoreNeuron icon indicating copy to clipboard operation
CoreNeuron copied to clipboard

Prefix project macros to prevent conflicts

Open tristan0x opened this issue 6 years ago • 5 comments

Preprocessing macros defined by the project should be prefixed by CORENEURON_ to prevent possible conflicts.

tristan0x avatar Mar 15 '19 09:03 tristan0x

Hi @tristan0x, is this open and can be worked upon?

tapaswenipathak avatar Apr 16 '19 14:04 tapaswenipathak

Hello @tapaswenipathak Thank you for your interest in CoreNeuron!

According to the add_definitions references in CMakeLists.txt files:

./CMakeLists.txt:    add_definitions("-DISPC_INTEROP=1")
./CMakeLists.txt:    add_definitions("-DNRNMPI=1")
./CMakeLists.txt:    add_definitions("-DNRNMPI=0")
./CMakeLists.txt:    add_definitions("-DNRN_MULTISEND=0")
./CMakeLists.txt:    add_definitions("-DLAYOUT=0")
./CMakeLists.txt:    add_definitions("-DLAYOUT=1")
./CMakeLists.txt:    add_definitions("-DENABLE_OMP_RUNTIME_SCHEDULE")
./CMakeLists.txt:    add_definitions("-DDISABLE_HOC_EXP")
./CMakeLists.txt:    add_definitions("-DENABLE_SPLAYTREE_QUEUING")
./CMakeLists.txt:    add_definitions("-DNET_RECEIVE_BUFFERING=0")
./CMakeLists.txt:        add_definitions("-DENABLE_REPORTING")
./CMakeLists.txt:    add_definitions("-DCORENEURON_CALIPER")
./CMakeLists.txt:  add_definitions("-DHAVE_MALLOC_H")
./CMakeLists.txt:add_definitions(-DCORENEURON_BUILD)
./CMakeLists.txt:    add_definitions(-DSWAP_ENDIAN_DISABLE_ASM)
./CMakeLists.txt:        add_definitions( -DPG_ACC_BUGS)
./CMakeLists.txt:                add_definitions( -DCUDA_PROFILING)
./CMakeLists.txt:        add_definitions(-DCUDA_MODULES_DISABLED)
./CMakeLists.txt:    add_definitions("-DDISABLE_TIMEOUT")
./CMakeLists.txt:    add_definitions("-DEXPORT_MECHS_FUNCTIONS")
./tests/CMakeLists.txt:    add_definitions(-DBOOST_TEST_DYN_LINK=TRUE)
./external/mod2c/src/mod2c_core/CMakeLists.txt:add_definitions(-DNMODL=1 -DBBCORE=1 -DNOCMODL=1 -DCVODE=1 -DVECTORIZE=1)

I think we should prefix the following variables:

  • ISPC_INTEROP
  • LAYOUT
  • ENABLE_OMP_RUNTIME_SCHEDULE
  • DISABLE_HOC_EXP
  • ENABLE_SPLAYTREE_QUEUING
  • ENABLE_REPORTING
  • HAVE_MALLOC_H
  • SWAP_ENDIAN_DISABLE_ASM
  • PG_ACC_BUGS
  • CUDA_PROFILING
  • CUDA_MODULES_DISABLED
  • DISABLE_TIMEOUT
  • EXPORT_MECHS_FUNCTIONS

The following should be probably kept intact because probably used by Neuron:

  • NRNMPI
  • NRN_MULTISEND
  • NET_RECEIVE_BUFFERING (is this a standard variable @pramodk ?)

Besides, I also suggest the following renaming:

  • replace ENABLE by USE, for instance CORENEURON_USE_REPORTING
  • add ENABLE when missing, for instance CORENEURON_ENABLE_CALIPER instead of CORENEURON_CALIPER
  • CORENEURON_USE_SOA_LAYOUT instead of CORENEURON_LAYOUT

Can you please confirm @pramodk ?

tristan0x avatar Apr 17 '19 06:04 tristan0x

I agree with @tristan0x. These macros and cmake has been organically growing. We will start redesign aspects soon!

pramodk avatar Apr 22 '19 22:04 pramodk

It would still be good to do this. With today's master we have:

set(UNIFIED_MEMORY_DEF -DUNIFIED_MEMORY)
set(CUDA_PROFILING_DEF -DCUDA_PROFILING)
CMakeLists.txt:  add_definitions("-DHAVE_MALLOC_H")
CMakeLists.txt:  add_definitions("-DLAYOUT=0")
CMakeLists.txt:  add_definitions("-DDISABLE_HOC_EXP")
CMakeLists.txt:  add_definitions("-DENABLE_SPLAYTREE_QUEUING")
CMakeLists.txt:  add_definitions("-DNET_RECEIVE_BUFFERING=0")
CMakeLists.txt:  add_definitions("-DDISABLE_TIMEOUT")
CMakeLists.txt:  add_definitions("-DENABLE_BIN_REPORTS")
CMakeLists.txt:  add_definitions("-DENABLE_SONATA_REPORTS")

which look they should have prefixes added.

olupton avatar Jun 29 '21 13:06 olupton

As well as adding prefixes, we should make sure the prefixes are consistent. There are currently CORENRN_ ("mainly" CMake) and CORENEURON_ ("mainly" preprocessor macros).

olupton avatar Dec 06 '21 21:12 olupton