Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b13b0b1
Fixing nrnivmodl-core: dir creation, shbang, ;-I
ferdonline Feb 18, 2019
eba50f7
Drop unnecessary mkdir step
ferdonline Feb 18, 2019
324dc0b
Avoiding duplicate symbols when using nrnivmodl-core
ferdonline Feb 20, 2019
4b32757
Generating libcorenrnmech featuring solve_core()
ferdonline Feb 21, 2019
0d856e1
Fix: -DADDITIONAL_MECHS to be passed to mech lib
ferdonline Feb 21, 2019
84a152a
cosmetics
ferdonline Feb 21, 2019
9454d6d
minot text update
pramodk Feb 21, 2019
beecc0b
Add missing kinderiv dependency
Feb 21, 2019
4c1c6cf
Fix incorporation of scopmath to mechlib in linux
ferdonline Feb 21, 2019
0083a37
Install libcorenrnmech for coreneuron_exe to work properly
pramodk Feb 21, 2019
bf85588
Disable new-dtags with newer linkers
pramodk Feb 21, 2019
9a71127
Fix issues with PGI compiler
pramodk Feb 21, 2019
4f6fc69
disable dtags again
pramodk Feb 21, 2019
83f704c
Install libcudacoreneuron; link missing
pramodk Feb 21, 2019
387c7fe
Allowing static corenrnmech
ferdonline Feb 22, 2019
e8b57ff
Set rpath on libcorenrnmech for compat w RUNPATH
ferdonline Feb 22, 2019
4dd6503
Fix for GPU. Simplified build and fixed link flag
ferdonline Feb 25, 2019
63f250a
Fixing rpath Origin in Mac and added deploy script
ferdonline Feb 26, 2019
7a427ee
Pretty UI :)
ferdonline Feb 26, 2019
cd17377
Configurable parallelism
ferdonline Feb 26, 2019
3a09d20
Revert cuda_wrap_srcs as cuda routines doesnt get linked properly
pramodk Feb 26, 2019
8293f1e
Remove Wall flags from default compilation
pramodk Feb 26, 2019
1b0f3c0
Restructure and warning fix
pramodk Feb 26, 2019
0ea03fb
Cleanup debug messages in GPU implementation
pramodk Feb 26, 2019
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
16 changes: 8 additions & 8 deletions CMake/config/ReleaseDebugAutoFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ endif()
include(CompilerFlagsHelpers)


set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_WARNING_ALL} ${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_DEBUGINFO_FLAGS} ${CMAKE_C_WARNING_ALL} ${CMAKE_C_OPT_NONE} ${CMAKE_C_STACK_PROTECTION}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_DEBUGINFO_FLAGS} ${CMAKE_C_WARNING_ALL} ${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_FAST "${CMAKE_C_WARNING_ALL} ${CMAKE_C_OPT_FASTEST} ${CMAKE_C_LINK_TIME_OPT} ${CMAKE_C_GEN_NATIVE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_DEBUGINFO_FLAGS} ${CMAKE_C_OPT_NONE} ${CMAKE_C_STACK_PROTECTION}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_DEBUGINFO_FLAGS} ${CMAKE_C_OPT_NORMAL}")
set(CMAKE_C_FLAGS_FAST " ${CMAKE_C_OPT_FASTEST} ${CMAKE_C_LINK_TIME_OPT} ${CMAKE_C_GEN_NATIVE}")



set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_WARNING_ALL} ${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_DEBUGINFO_FLAGS} ${CMAKE_CXX_WARNING_ALL} ${CMAKE_CXX_OPT_NONE} ${CMAKE_CXX_STACK_PROTECTION}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_DEBUGINFO_FLAGS} ${CMAKE_CXX_WARNING_ALL} ${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_FAST "${CMAKE_CXX_WARNING_ALL} ${CMAKE_CXX_OPT_FASTEST} ${CMAKE_CXX_LINK_TIME_OPT} ${CMAKE_CXX_GEN_NATIVE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_DEBUGINFO_FLAGS} ${CMAKE_CXX_OPT_NONE} ${CMAKE_CXX_STACK_PROTECTION}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_DEBUGINFO_FLAGS} ${CMAKE_CXX_OPT_NORMAL}")
set(CMAKE_CXX_FLAGS_FAST " ${CMAKE_CXX_OPT_FASTEST} ${CMAKE_CXX_LINK_TIME_OPT} ${CMAKE_CXX_GEN_NATIVE}")

2 changes: 2 additions & 0 deletions CMake/config/SetRpath.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ IF( NOT BLUEGENE AND NOT CRAY_SYSTEM)
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")

# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${LIB_INSTALL_DIR}" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "PGI")
endif()

if(ENABLE_OPENACC)
set(COMPILE_LIBRARY_TYPE "STATIC")
if(${CMAKE_C_COMPILER_ID} STREQUAL "PGI")
add_definitions( -DPG_ACC_BUGS)
set(ACC_FLAGS "-acc -Minline=size:200,levels:10")
Expand All @@ -232,7 +233,6 @@ if(ENABLE_OPENACC)
if(ENABLE_CUDA_MODULES)
find_package(CUDA 5.0)
SET(CUDA_SEPARABLE_COMPILATION ON)

if(CUDA_FOUND)
if(ENABLE_SELECTIVE_GPU_PROFILING)
add_definitions( -DCUDA_PROFILING)
Expand All @@ -253,6 +253,7 @@ ELSE(ENABLE_OPENACC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IGNORE_UNKNOWN_PRAGMA_FLAGS}")
endif(ENABLE_OPENACC)


if(DISABLE_NRN_TIMEOUT)
add_definitions("-DDISABLE_TIMEOUT")
endif()
Expand Down
18 changes: 6 additions & 12 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@

include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/coreneuron ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_BINARY_DIR}/coreneuron)

# The mechanism registration function will be always defined from extra mechanisms in test directory
add_definitions(-DADDITIONAL_MECHS)

# LIbrary required for special
add_library(coreneuron_main STATIC "coreneuron.cpp")

add_executable(coreneuron_exec "${CMAKE_CURRENT_SOURCE_DIR}/coreneuron.cpp")

set_target_properties(coreneuron_exec PROPERTIES
OUTPUT_NAME "coreneuron_exec")

target_link_libraries(coreneuron_exec coreneuron ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES} ${reportinglib_LIBRARY})
target_link_libraries(coreneuron_exec corenrnmech
${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES} ${reportinglib_LIBRARY})

install(TARGETS coreneuron_exec
DESTINATION "${CMAKE_INSTALL_BINDIR}")

install(TARGETS coreneuron_main
DESTINATION "${CMAKE_INSTALL_LIBDIR}")

# Install main to recompile for special-core
install(FILES coreneuron.cpp
DESTINATION ${CMAKE_INSTALL_DATADIR}/coreneuron)
10 changes: 2 additions & 8 deletions apps/coreneuron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <coreneuron/engine.h>
extern "C" {extern void modl_reg(void);}
#include <coreneuron/enginemech.h>

int main(int argc, char** argv) {
return solve_core(argc, argv);
return solve_core(argc, argv);
}

/// Declare an empty function if Neurodamus mechanisms are not used, otherwise register them in mechs/cfile/mod_func.c
#ifndef ADDITIONAL_MECHS
void modl_reg() {}
#endif
81 changes: 59 additions & 22 deletions coreneuron/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ include_directories(utils/randoms)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${MPI_INCLUDE_PATH})

FILE(GLOB_RECURSE coreneuron_all_headers "*.h*")
FILE(GLOB_RECURSE coreneuron_all_templates "*.ipp")
FILE(GLOB_RECURSE coreneuron_all_c_files "*.c*")
file(GLOB_RECURSE coreneuron_all_headers "*.h*")
file(GLOB_RECURSE coreneuron_all_templates "*.ipp")
file(GLOB_RECURSE coreneuron_cuda_files "*.cu")
file(GLOB_RECURSE coreneuron_all_c_files "nrniv/*.c*" "nrnmpi/*.c*" "nrnoc/*.c*"
"nrnomp/*.c*" "utils/*.c*")
set(DIMPLIC_C "mech/dimplic.cpp")
file(GLOB_RECURSE scopmath_c_files "scopmath_core/*.c*")


# Compile and include MOD files

Expand Down Expand Up @@ -228,6 +232,7 @@ add_custom_command(OUTPUT "${KINDERIV_H}"
DEPENDS ${MOD2C_OPTMECH_OUTPUTS} ${MOD2C_STDMECH_OUTPUTS} "${KINDERIV_PY}"
COMMAND python "${KINDERIV_PY}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_custom_target(kinderiv DEPENDS "${KINDERIV_H}")

if (EXPORT_MECHS_FUNCTIONS)
# Create C file with all "get function pointers" methods
Expand All @@ -242,7 +247,8 @@ if (EXPORT_MECHS_FUNCTIONS)
endif()

# Add generated sources from MOD files
set(GENERATED_MECH_C_FILES ${MOD_FUNC_C} ${MOD_FUNC_PTRS_C} ${MOD2C_STDMECH_OUTPUTS} ${MOD2C_OPTMECH_OUTPUTS})
set(ADDITIONAL_MECH_C_FILES ${MOD_FUNC_C} ${MOD_FUNC_PTRS_C} ${DIMPLIC_C} ${MOD2C_OPTMECH_OUTPUTS})
set(GENERATED_MECH_C_FILES ${ADDITIONAL_MECH_C_FILES} ${MOD2C_STDMECH_OUTPUTS})

# artificial cells must be on cpu, defaul nrnran123.c is for cpu, nrn_setup.cpp uses nrnran123 for only memory calculation purpose which should use cpu version of nrnran123
set(NOACC_MECH_C_FILES
Expand All @@ -261,8 +267,6 @@ if(ENABLE_OPENACC)
endif()
endif()

set(coreneuron_all_c_files ${coreneuron_all_c_files} ${GENERATED_MECH_C_FILES})

#to indent generated c/cpp files
if(CLANG_FORMAT_FOUND)
add_custom_target(formatbuild
Expand All @@ -275,8 +279,6 @@ if(CLANG_FORMAT_FOUND)
endif()


add_library(coreneuron ${COMPILE_LIBRARY_TYPE} ${coreneuron_all_headers} ${coreneuron_all_templates} ${coreneuron_all_c_files} ${KINDERIV_H})

set(link_cudacoreneuron)
set(link_reportinglib)

Expand All @@ -288,6 +290,7 @@ if(ENABLE_OPENACC AND ENABLE_CUDA_MODULES)
-gencode=arch=compute_50,code=sm_50
-gencode=arch=compute_52,code=sm_52
-gencode=arch=compute_52,code=compute_52
-Xcompiler -fPIC
)
set(link_cudacoreneuron cudacoreneuron)
endif()
Expand All @@ -297,8 +300,20 @@ if(ENABLE_REPORTINGLIB)
endif()



############################################################
# Target libs
############################################################

#
# The coreneuron lib (only internal mechanisms)
#
add_library(coreneuron ${COMPILE_LIBRARY_TYPE} ${coreneuron_all_headers} ${coreneuron_all_templates}
${coreneuron_all_c_files} ${cudacorenrn_objs} ${MOD2C_STDMECH_OUTPUTS})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${coreneuron_all_c_files} ${cudacorenrn_objs} ${MOD2C_STDMECH_OUTPUTS})
${coreneuron_all_c_files} ${MOD2C_STDMECH_OUTPUTS})

add_dependencies(coreneuron kinderiv)

target_link_libraries(coreneuron ${MPI_CXX_LIBRARIES}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${cudacorenrn_objs} doesnt exist now, right?

${link_reportinglib} ${link_cudacoreneuron} ${CUDA_LIBRARIES} )
${link_reportinglib} ${link_cudacoreneuron} ${CUDA_LIBRARIES})

set_target_properties(coreneuron PROPERTIES
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
Expand All @@ -315,31 +330,53 @@ set(CORENRN_LINK_LIBS ${CORENRN_LINK_LIBS} PARENT_SCOPE)
set(CORENRN_OPTMECH_MODS "${MOD2C_OPTMECH_MODS}" PARENT_SCOPE)


install(TARGETS coreneuron
# The scopmath lib - should not contain dimplic
add_library(scopmath STATIC ${coreneuron_all_headers} ${scopmath_c_files})
set_target_properties(scopmath PROPERTIES POSITION_INDEPENDENT_CODE ON)

#
# The "complete" lib (coreneuron + opt mechs)
#
set(ENGINEMECH_C "mech/enginemech.cpp")
add_library(corenrnmech ${COMPILE_LIBRARY_TYPE} ${coreneuron_all_headers} ${ENGINEMECH_C} ${ADDITIONAL_MECH_C_FILES})
add_dependencies(corenrnmech kinderiv)

# The mechanism registration function will be always defined (at least for halfgap)
target_compile_definitions(corenrnmech PUBLIC -DADDITIONAL_MECHS)

# Public link interface (default), so that end binary links with all, even if they'r static
target_link_libraries(corenrnmech scopmath coreneuron)


#########################################################
# INSTALL
#########################################################

install(TARGETS coreneuron corenrnmech ${link_cudacoreneuron}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(FILES "engine.h"
install(FILES "engine.h" "enginemech.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coreneuron)

install(PROGRAMS ${MOD2C_BINARY}
DESTINATION ${CMAKE_INSTALL_BINDIR})

install(FILES ${MOD2C_UNITS}
DESTINATION ${CMAKE_INSTALL_DATADIR}/mod2c)


if(ENABLE_HEADER_INSTALL)
install(DIRECTORY .
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coreneuron
FILES_MATCHING PATTERN "*.h*" PATTERN "*.ipp")

install(FILES ${KINDERIV_PY}
install(FILES ${KINDERIV_PY} ${MOD_FUNC_C_PL} ${DIMPLIC_C} ${ENGINEMECH_C}
DESTINATION ${CMAKE_INSTALL_DATADIR}/coreneuron)

install(FILES ${MOD_FUNC_C_PL}
install(TARGETS scopmath
DESTINATION ${CMAKE_INSTALL_DATADIR}/coreneuron)

install(DIRECTORY "scopmath_core"
DESTINATION ${CMAKE_INSTALL_DATADIR}/coreneuron
FILES_MATCHING PATTERN "dimplic.cpp")
install(FILES ${MOD2C_OPTMECH_OUTPUTS}
DESTINATION ${CMAKE_INSTALL_DATADIR}/mod2c)
endif()

install(PROGRAMS ${MOD2C_BINARY}
DESTINATION ${CMAKE_INSTALL_BINDIR})

install(FILES ${MOD2C_UNITS}
DESTINATION ${CMAKE_INSTALL_DATADIR}/mod2c)
5 changes: 4 additions & 1 deletion coreneuron/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int solve_core(int argc, char** argv);

extern void mk_mech_init(int argc, char** argv);
extern int run_solve_core(int argc, char** argv);

#ifdef __cplusplus
}
#endif
Expand Down
14 changes: 14 additions & 0 deletions coreneuron/enginemech.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef CORENEURON_ENGINEMECH_H
#define CORENEURON_ENGINEMECH_H

#ifdef __cplusplus
extern "C" {
#endif

int solve_core(int argc, char** argv);

#ifdef __cplusplus
}
#endif

#endif
21 changes: 21 additions & 0 deletions coreneuron/mech/enginemech.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// Corenrnmech is a wrapper lib providing a single solve_core function
/// which initializes the solver, loads the external mechanisms and launches the simulation

#include <coreneuron/enginemech.h>
#include <coreneuron/engine.h>

#ifdef ADDITIONAL_MECHS
namespace coreneuron{ extern void modl_reg(); }
#endif

int solve_core(int argc, char** argv) {

mk_mech_init(argc, argv);

#ifdef ADDITIONAL_MECHS
/// Initializing additional Neurodamus mechanisms (in mod_func.c, built by mech/mod_func.c.pl)
coreneuron::modl_reg();
#endif

return run_solve_core(argc, argv);
}
2 changes: 0 additions & 2 deletions coreneuron/nrniv/cuda_profile.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ void print_gpu_memory_usage() {

void start_cuda_profile() {
cudaProfilerStart();
print_gpu_memory_usage();
}

void stop_cuda_profile() {
cudaProfilerStop();
print_gpu_memory_usage();
}
Loading