Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 4115d40

Browse files
jorblancoapramodk
authored andcommitted
Added support for SONATA reports (#211)
- Call records_write_spikes - Change SONATA reportinglib library name - Move from find_package() module mode to config mode - Removed Findsonatareport.cmake file - find_package(sonata) found through config file (sonata_DIR needs to be passed to cmake)
1 parent 48791d3 commit 4115d40

File tree

10 files changed

+46
-5
lines changed

10 files changed

+46
-5
lines changed

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ include(CTest)
5050
option(CORENRN_ENABLE_OPENMP "Build the CORE NEURON with OpenMP implementation" ON)
5151
option(CORENRN_ENABLE_TIMEOUT "Enable nrn_timeout implementation" ON)
5252
option(CORENRN_ENABLE_REPORTINGLIB "Enable use of ReportingLib for soma reports" OFF)
53+
option(CORENRN_ENABLE_SONATA "Enable SONATA output format" OFF)
5354
option(CORENRN_ENABLE_MPI "Enable MPI-based execution" ON)
5455
option(CORENRN_ENABLE_SOA "Enable SoA Memory Layout" ON)
5556
option(CORENRN_ENABLE_HOC_EXP "Enable wrapping exp with hoc_exp()" OFF)
@@ -139,11 +140,20 @@ if(NOT CORENRN_ENABLE_TIMEOUT)
139140
add_definitions("-DDISABLE_TIMEOUT")
140141
endif()
141142

143+
if ( CORENRN_ENABLE_SONATA AND CORENRN_ENABLE_REPORTINGLIB )
144+
message(FATAL_ERROR "Can't have enabled both SONATA reports and reportinglib")
145+
endif()
146+
142147
if(CORENRN_ENABLE_REPORTINGLIB)
143148
find_package(reportinglib REQUIRED)
144149
include_directories(${reportinglib_INCLUDE_DIR})
145150
add_definitions("-DENABLE_REPORTING")
146151
endif()
152+
if(CORENRN_ENABLE_SONATA)
153+
find_package(sonata QUIET PATHS ${sonata_DIR}/share/sonata/CMake)
154+
include_directories(${sonatareport_INCLUDE_DIR})
155+
add_definitions("-DENABLE_SONATA_REPORTS -DENABLE_REPORTING")
156+
endif()
147157

148158
if(MINGW)
149159
add_definitions("-DMINGW")
@@ -247,8 +257,14 @@ if(cmake_generator_tolower MATCHES "makefile")
247257
message(STATUS "Likwid | ${CORENRN_ENABLE_LIKWID_PROFILING}")
248258
message(STATUS "Unit Tests | ${CORENRN_ENABLE_UNIT_TESTS}")
249259
message(STATUS "ReportingLib | ${CORENRN_ENABLE_REPORTINGLIB}")
260+
message(STATUS " SONATA support | ${CORENRN_ENABLE_SONATA}")
250261
if(CORENRN_ENABLE_REPORTINGLIB)
251262
message(STATUS " INC | ${reportinglib_INCLUDE_DIR}")
263+
message(STATUS " LIB | ${reportinglib_LIBRARY}")
264+
endif()
265+
if(CORENRN_ENABLE_SONATA)
266+
message(STATUS " INC | ${sonatareport_INCLUDE_DIR}")
267+
message(STATUS " LIB | ${sonatareport_LIBRARY}")
252268
endif()
253269

254270
message(STATUS "--------------+--------------------------------------------------------------")

apps/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ target_link_libraries(nrniv-core
1111
corenrnmech
1212
${MPI_C_LIBRARIES}
1313
${MPI_CXX_LIBRARIES}
14-
${reportinglib_LIBRARY})
14+
${reportinglib_LIBRARY}
15+
${sonatareport_LIBRARY})
1516
set_target_properties(nrniv-core PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
1617

1718
# main program required for building special-core

coreneuron/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ add_library(corenrnmech
162162
target_link_libraries(coreneuron
163163
${MPI_CXX_LIBRARIES}
164164
${reportinglib_LIBRARY}
165+
${sonatareport_LIBRARY}
165166
${link_cudacoreneuron}
166167
${CUDA_LIBRARIES}
167168
${CALIPER_LIB}

coreneuron/nrniv/output_spikes.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ THE POSSIBILITY OF SUCH DAMAGE.
4141
#include "coreneuron/nrnmpi/nrnmpi_impl.h"
4242
#include "coreneuron/nrnmpi/nrnmpidec.h"
4343
#include "coreneuron/utils/string_utils.h"
44+
#ifdef ENABLE_SONATA_REPORTS
45+
#include "reportinglib/records.h"
46+
#endif
4447

4548
namespace coreneuron {
4649
std::vector<double> spikevec_time;
@@ -158,6 +161,9 @@ void output_spikes_parallel(const char* outpath) {
158161
if (nrnmpi_myid == 0) {
159162
remove(fname.c_str());
160163
}
164+
#ifdef ENABLE_SONATA_REPORTS
165+
records_write_spikes(spikevec_time, spikevec_gid);
166+
#else
161167
sort_spikes(spikevec_time, spikevec_gid);
162168
nrnmpi_barrier();
163169

@@ -211,7 +217,9 @@ void output_spikes_parallel(const char* outpath) {
211217

212218
MPI_File_close(&fh);
213219
free(spike_data);
220+
#endif
214221
}
222+
215223
#endif
216224

217225
void output_spikes_serial(const char* outpath) {

coreneuron/utils/reports/nrnreport.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ THE POSSIBILITY OF SUCH DAMAGE.
3535
#include "coreneuron/nrnoc/mech_mapping.hpp"
3636
#include "coreneuron/nrnoc/membfunc.h"
3737
#ifdef ENABLE_REPORTING
38+
#ifdef ENABLE_SONATA_REPORTS
39+
#include "reportinglib/records.h"
40+
#else
3841
#include "reportinglib/Records.h"
3942
#endif
43+
#endif
4044
#include <iostream>
4145
#include <vector>
4246
#include <algorithm>

tests/jenkins/Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,11 @@ pipeline {
317317
}
318318
}
319319
}
320+
post {
321+
always {
322+
dir("${WORKSPACE}") {
323+
deleteDir()
324+
}
325+
}
326+
}
320327
}

tests/unit/cmdline_interface/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ target_link_libraries(cmd_interface_test_bin
1111
${MPI_CXX_LIBRARIES}
1212
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
1313
coreneuron
14-
${reportinglib_LIBRARY})
14+
${reportinglib_LIBRARY}
15+
${sonatareport_LIBRARY})
1516

1617
add_test(NAME cmd_interface_test
1718
COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/cmd_interface_test_bin)

tests/unit/interleave_info/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ target_link_libraries(interleave_info_bin
1111
${MPI_CXX_LIBRARIES}
1212
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
1313
coreneuron
14-
${reportinglib_LIBRARY})
14+
${reportinglib_LIBRARY}
15+
${sonatareport_LIBRARY})
1516

1617
add_test(NAME interleave_info_constructor_test
1718
COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/interleave_info_bin)

tests/unit/queueing/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ target_link_libraries(queuing_test_bin
1111
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
1212
${Boost_SYSTEM_LIBRARY}
1313
coreneuron
14-
${reportinglib_LIBRARY})
14+
${reportinglib_LIBRARY}
15+
${sonatareport_LIBRARY})
1516

1617
add_test(NAME queuing_test COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/queuing_test_bin)

tests/unit/sdprintf/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ add_executable(sdprintf_test_bin ${sdprintf_test_src})
1111
target_link_libraries(sdprintf_test_bin
1212
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
1313
coreneuron
14-
${reportinglib_LIBRARY})
14+
${reportinglib_LIBRARY}
15+
${sonatareport_LIBRARY})
1516

1617
add_test(NAME sdprintf_test
1718
COMMAND ${TEST_EXEC_PREFIX} ${CMAKE_CURRENT_BINARY_DIR}/sdprintf_test_bin)

0 commit comments

Comments
 (0)