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

Commit 5df61b6

Browse files
authored
Add GitLab CI pipeline. (#500)
* Add GitLab CI configuration. * Small CMake changes for gitlab integration * Added CMake/coreneuron-config.cmake.in for passing options to NEURON
1 parent db1a70d commit 5df61b6

File tree

5 files changed

+78
-8
lines changed

5 files changed

+78
-8
lines changed

.gitlab-ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
include:
2+
- project: hpc/gitlab-pipelines
3+
file:
4+
- spack-build-components.gitlab-ci.yml
5+
- github-project-pipelines.gitlab-ci.yml
6+
7+
stages:
8+
- .pre
9+
- build
10+
- test
11+
- build_neuron
12+
- test_neuron
13+
14+
# Set up Spack
15+
spack_setup:
16+
extends: .spack_setup_ccache
17+
18+
.spack_intel:
19+
variables:
20+
SPACK_PACKAGE_COMPILER: intel
21+
.spack_coreneuron:
22+
variables:
23+
SPACK_PACKAGE: coreneuron
24+
SPACK_PACKAGE_SPEC: +debug+tests~legacy-unit
25+
.spack_neuron:
26+
variables:
27+
SPACK_PACKAGE: neuron
28+
SPACK_PACKAGE_REF: '' # Take the default branch
29+
SPACK_PACKAGE_SPEC: +coreneuron+debug+tests~legacy-unit
30+
31+
# CoreNEURON will be checked out for us by default
32+
build:coreneuron:intel:
33+
extends:
34+
- .spack_build
35+
- .spack_coreneuron
36+
- .spack_intel
37+
38+
test:coreneuron:intel:
39+
extends:
40+
- .ctest
41+
needs: ["build:coreneuron:intel"]
42+
43+
build:neuron:intel:
44+
stage: build_neuron
45+
extends:
46+
- .spack_build
47+
- .spack_neuron
48+
- .spack_intel
49+
needs: ["build:coreneuron:intel"]
50+
51+
test:neuron:intel:
52+
stage: test_neuron
53+
before_script:
54+
- !reference [.ctest, before_script]
55+
# Wipe Slurm environment to try and keep mpiexec happy.
56+
- unset $(env|awk -F= '/^SLURM_/ {if (match($1, "_(ACCOUNT|PARTITION)$")==0) print $1}')
57+
extends:
58+
- .ctest
59+
needs: ["build:neuron:intel"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
get_filename_component(CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
1010

11+
set(CORENRN_ENABLE_GPU @CORENRN_ENABLE_GPU@)
12+
set(CORENRN_ENABLE_NMODL @CORENRN_ENABLE_NMODL@)
13+
set(CORENRN_ENABLE_REPORTING @CORENRN_ENABLE_REPORTING@)
14+
1115
find_path(CORENEURON_INCLUDE_DIR "coreneuron/coreneuron.h" HINTS "${CONFIG_PATH}/../../include")
1216
find_path(
1317
CORENEURON_LIB_DIR

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ endif()
316316
# =============================================================================
317317
# Install cmake modules
318318
# =============================================================================
319-
install(FILES CMake/coreneuron-config.cmake DESTINATION share/cmake)
319+
configure_file(CMake/coreneuron-config.cmake.in CMake/coreneuron-config.cmake @ONLY)
320+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CMake/coreneuron-config.cmake" DESTINATION share/cmake)
320321
install(EXPORT coreneuron DESTINATION share/cmake)
321322

322323
if(NOT CORENEURON_AS_SUBPROJECT)

coreneuron/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ set(NMODL_UNITS_FILE "${CMAKE_BINARY_DIR}/share/mod2c/nrnunits.lib")
5858
file(GLOB builtin_modfiles
5959
"${CORENEURON_PROJECT_SOURCE_DIR}/coreneuron/mechanism/mech/modfile/*.mod")
6060
# get the corresponding list of paths to the modfiles in the build directory
61-
set(builtin_modfile_in_build_dir)
61+
set(builtin_modfiles_in_build_dir)
6262
foreach(builtin_modfile ${builtin_modfiles})
6363
get_filename_component(builtin_modfile_name "${builtin_modfile}" NAME)
64-
list(APPEND builtin_modfile_in_build_dir
64+
list(APPEND builtin_modfiles_in_build_dir
6565
"${CMAKE_BINARY_DIR}/share/modfile/${builtin_modfile_name}")
6666
endforeach()
6767
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/share/modfile")
6868
# set up a build rule that ensures the modfiles in the build directory are updated if their
6969
# counterparts in the source directory are touched
7070
add_custom_command(
71-
OUTPUT ${builtin_modfile_in_build_dir}
71+
OUTPUT ${builtin_modfiles_in_build_dir}
7272
DEPENDS ${builtin_modfiles}
7373
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${builtin_modfiles}
7474
"${CMAKE_BINARY_DIR}/share/modfile")
75-
add_custom_target(copy-builtin-modfiles ALL DEPENDS ${builtin_modfile_in_build_dir})
75+
add_custom_target(copy-builtin-modfiles ALL DEPENDS ${builtin_modfiles_in_build_dir})
7676
set(CORENEURON_BUILTIN_MODFILES
77-
"${builtin_modfile_in_build_dir}"
77+
"${builtin_modfiles_in_build_dir}"
7878
CACHE STRING "List of builtin modfiles that nrnivmodl-core implicitly depends on" FORCE)
7979

8080
# =============================================================================

tests/integration/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/ring/out.dat.ref"
7979
# Configure test scripts
8080
foreach(args_line ${TEST_CASES_WITH_ARGS})
8181
string(REPLACE "!" ";" string_line ${args_line})
82+
set(test_num_processors 1)
8283
if(MPI_FOUND)
8384
# serial test run without srun or mpiexec
8485
if(args_line MATCHES "ring_serial.*")
8586
string(REPLACE ";" " " SRUN_PREFIX "")
8687
else()
87-
string(REPLACE ";" " " SRUN_PREFIX "${TEST_MPI_EXEC_BIN};-n;2")
88+
set(test_num_processors 2)
89+
string(REPLACE ";" " " SRUN_PREFIX "${TEST_MPI_EXEC_BIN};-n;${test_num_processors}")
8890
endif()
8991
endif()
9092
list(GET string_line 0 TEST_NAME)
@@ -95,12 +97,15 @@ foreach(args_line ${TEST_CASES_WITH_ARGS})
9597
NAME ${TEST_NAME}_TEST
9698
COMMAND "/bin/sh" ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}/integration_test.sh
9799
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}")
100+
set_tests_properties(${TEST_NAME}_TEST PROPERTIES PROCESSORS ${test_num_processors})
98101
endforeach()
99102

100103
foreach(args_line ${NEGATIVE_TEST_CASES})
101104
string(REPLACE "!" ";" string_line ${args_line})
105+
set(test_num_processors 1)
102106
if(MPI_FOUND)
103-
string(REPLACE ";" " " SRUN_PREFIX "${TEST_MPI_EXEC_BIN};-n;2")
107+
set(test_num_processors 2)
108+
string(REPLACE ";" " " SRUN_PREFIX "${TEST_MPI_EXEC_BIN};-n;${test_num_processors}")
104109
endif()
105110
list(GET string_line 0 TEST_NAME)
106111
list(GET string_line 1 TEST_ARGS)
@@ -110,6 +115,7 @@ foreach(args_line ${NEGATIVE_TEST_CASES})
110115
NAME ${TEST_NAME}_TEST
111116
COMMAND "/bin/sh" ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}/negative_integration_test.sh
112117
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}")
118+
set_tests_properties(${TEST_NAME}_TEST PROPERTIES PROCESSORS ${test_num_processors})
113119
endforeach()
114120

115121
if(CORENRN_ENABLE_REPORTING)

0 commit comments

Comments
 (0)