Skip to content

Commit 3305eef

Browse files
committed
This commit includes several changes:
1) Porting biodynamo to other linux platforms like all red hat and debian based distros with the option of compiling requirements like root qt abnd paraview (changes included on the cmakelists file, the corresponding root, qt and paraview cmake files as well as scripts included on the /util/build-third-party directory as well as changes in the util.sh file that performs the detection of the new operating systems with the DetectOs2 function) as well as requirements scripts and files that cover a wide range of redhat based and debian based distros 2) Because gcc versions older than 8 and newer than 11 can cause installation and project running problems (especially with the case of omp.h) we also provide gcc 11.5.0 3) The option of installing nest with biodynamo (provided via a cmake option (-Dnest) and build via build-nest_new.sh located on the util/build-third-party directory) 4) Fixing sbml support on mac os by compiling libroadrunner via a script located in util/build-third-party directory 5) Also experimental suse linux support (root does not compile due to a bug) Possible bugs: Sometimes after the compilation of paraview, biodynamo fails to compile. In this case just rerun the installation. *Note* In order to prevent the recompilation of any requirement due to a failure that may occur later on the installation reuirements are installed in the biodynamo(src)/third-party directory and then copied into the appriopriate build and installation directory
1 parent 2619fe5 commit 3305eef

File tree

74 files changed

+1340
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1340
-154
lines changed

CMakeLists.txt

+26-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# -----------------------------------------------------------------------------
1414

1515
cmake_minimum_required(VERSION 3.19.3 FATAL_ERROR)
16-
1716
set(policy_new CMP0072 CMP0077)
1817
foreach(policy ${policy_new})
1918
if(POLICY ${policy})
@@ -98,6 +97,7 @@ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_ROOT}/share")
9897
set(CMAKE_INSTALL_CMAKEDATADIR "${CMAKE_INSTALL_DATADIR}/cmake")
9998
set(CMAKE_INSTALL_THIRDPARTY "${CMAKE_INSTALL_ROOT}")
10099

100+
101101
# It is used by format/style checks. It needs to be defined here such
102102
# to enable relocation of the scripts.
103103
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/util/housekeeping")
@@ -137,8 +137,14 @@ option(jemalloc "Use jemalloc for memory allocations." OFF)
137137
option(website "Enable website generation (make website<-live>)." OFF)
138138
option(valgrind "Enable valgrind tests and make build compatible with valgrind tool." ON)
139139
option(rpath "Link libraries with built-in RPATH (run-time search path)." OFF)
140+
option(nest "Install The Neural Simulation Tool (NEST) for spiking neural network models." ON)
140141
option(real_t "Define data type for real numbers. Currently supported: float, double" double)
141142

143+
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/gcc")
144+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/gcc" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
145+
endif()
146+
147+
142148
if(APPLE)
143149
# ParaView on Apple devices
144150
set(CMAKE_BDM_PVVERSION "5.10")
@@ -416,7 +422,15 @@ endif()
416422

417423
if(sbml)
418424
if(APPLE)
419-
message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).")
425+
SET(LLRR_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party")
426+
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner")
427+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
428+
else()
429+
execute_process(COMMAND bash ${LLRR_BLD_SCRIPT_LOCATION}/build-roadrunner_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE LLRR_DOWNLOAD_OR_BUILD)
430+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
431+
endif()
432+
find_package(Libroadrunner)
433+
#message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).")
420434
endif()
421435
find_package(Libroadrunner)
422436
if(NOT Libroadrunner_FOUND)
@@ -425,6 +439,16 @@ if(sbml)
425439
endif()
426440
endif()
427441

442+
if(nest)
443+
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/nest")
444+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
445+
else()
446+
SET(NEST_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party")
447+
execute_process(COMMAND bash ${NEST_BLD_SCRIPT_LOCATION}/build-nest_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE NEST_DOWNLOAD_OR_BUILD)
448+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
449+
endif()
450+
endif()
451+
428452
# Load libgit2 if it is enabled
429453
if (libgit2)
430454
include(external/Libgit2)

cmake/FindROOT.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@
1616
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
1717
# dependencies in ROOT_GENERATE_DICTIONARY
1818

19+
if(NOT DEFINED ENV{ROOTSYS})
20+
SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root")
21+
elseif("$ENV{ROOTSYS}" STREQUAL "")
22+
SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root")
23+
endif()
24+
1925
find_program(ROOT_CONFIG_EXECUTABLE NAMES root-config
2026
HINTS "$ENV{ROOTSYS}/bin" "$ENV{BDM_ROOT_DIR}/bin" "${CMAKE_THIRD_PARTY_DIR}/root/bin")
21-
27+
28+
2229
execute_process(
2330
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
2431
OUTPUT_VARIABLE ROOTSYS

cmake/env/thisbdm.fish

100755100644
+36-10
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function source_thisbdm
101101

102102
set -l curr_filename (status --current-filename)
103103
set -gx BDMSYS (fish -c "cd (dirname $curr_filename)/..; and pwd"); or return 1
104-
104+
105105
if test -n "$old_bdmsys"; and test "$old_bdmsys" != "$BDMSYS"
106106
_bdm_warn "[WARN] You've already sourced another 'thisbdm' in your current shell session."
107107
_bdm_warn " -> prev. installation='$old_bdmsys'"
@@ -252,7 +252,7 @@ function source_thisbdm
252252
end
253253

254254
pyenv init --path $PYENV_NO_REHASH | source; or return 1
255-
pyenv init - $PYENV_NO_REHASH | source; or return 1
255+
pyenv init - $PYENV_NO_REHASH | source; or return 1
256256
pyenv shell @pythonvers@; or return 1
257257

258258
# Location of jupyter executable (installed with `pip install` command)
@@ -269,7 +269,7 @@ function source_thisbdm
269269
end
270270
########
271271

272-
#### ROOT Specific Configurations ####
272+
#### ROOT Specific Configurations ####
273273
if test -z "$BDM_CUSTOM_ROOT"
274274
if test -z "$ROOTSYS"
275275
set -gx BDM_CUSTOM_ROOT false
@@ -278,7 +278,7 @@ function source_thisbdm
278278
end
279279
end
280280

281-
if begin;
281+
if begin;
282282
test -z "$BDM_ROOT_DIR"; and test -z "$ROOTSYS";
283283
end; or test "$BDM_CUSTOM_ROOT" = false
284284
set -gx BDM_ROOT_DIR "$BDMSYS/third_party/root"
@@ -322,13 +322,13 @@ function source_thisbdm
322322
set -gx BDM_CUSTOM_PV true
323323
end
324324
end
325-
325+
326326
if test "$BDM_CUSTOM_PV" = false; or test -z "$ParaView_DIR"
327327
set -gx ParaView_DIR "$BDMSYS/third_party/paraview"
328328
else
329329
_bdm_info "[INFO] Custom ParaView 'ParaView_DIR=$ParaView_DIR'"
330330
end
331-
331+
332332
if not test -d "$ParaView_DIR"
333333
_bdm_err "[ERR] We are unable to find ParaView! Please make sure it is installed"
334334
_bdm_err " on your system! You can manually specify its location by executing"
@@ -377,7 +377,7 @@ function source_thisbdm
377377
set -gx BDM_CUSTOM_QT true
378378
end
379379
end
380-
380+
381381
if test "$BDM_CUSTOM_QT" = false; or test -z "$Qt5_DIR"
382382
set -gx Qt5_DIR "$BDMSYS/third_party/qt"
383383
else
@@ -415,6 +415,26 @@ function source_thisbdm
415415
# OpenMP
416416
set -gx OMP_PROC_BIND true
417417

418+
419+
#Select (export) the correct compiler version
420+
if test (echo "$GCC_VER >= 12" | bc -q) -eq 1 || test (echo "$GCC_VER < 8" | bc -q) -eq 1
421+
if command -q gcc-11 && command -q g++-11 && command -q gfortran-11
422+
set -gx CC gcc-11
423+
set -gx CXX g++-11
424+
set -gx FC gfortran-11
425+
set -gx OMPI_CC gcc-11
426+
set -gx OMPI_CXX g++-11
427+
set -gx OMPI_FC gfortran-11
428+
else if test -d "$BDMSYS/third_party/gcc"
429+
set -gx CC "$BDMSYS/third_party/gcc/bin/gcc"
430+
set -gx CXX "$BDMSYS/third_party/gcc/bin/g++"
431+
set -gx FC "$BDMSYS/third_party/gcc/bin/gfortran"
432+
set -gx OMPI_CC "$BDMSYS/third_party/gcc/bin/gcc"
433+
set -gx OMPI_CXX "$BDMSYS/third_party/gcc/bin/g++"
434+
set -gx OMPI_FC "$BDMSYS/third_party/gcc/bin/gfortran"
435+
end
436+
end
437+
418438
###### Platform-specific Configuration
419439
# Apple specific
420440
if test (uname) = 'Darwin'
@@ -429,15 +449,21 @@ function source_thisbdm
429449
. scl_source enable devtoolset-10; or return 1
430450
end
431451

432-
. /etc/profile.d/modules.sh; or return 1
433-
module load mpi; or return 1
434-
435452
# load llvm 6 required for libroadrunner
436453
if test -d "$BDMSYS"/third_party/libroadrunner
437454
. scl_source enable llvm-toolset-7; or return 1
438455
end
439456
end
440457
end
458+
459+
#LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS
460+
if test (uname) = "Linux"
461+
set PROCVERSION (cat /proc/version)
462+
if string match -iq '*Red Hat*' -- $PROCVERSION
463+
source /etc/profile.d/modules.sh; or return 1
464+
module load mpi; or return 1
465+
end
466+
end
441467
#######
442468

443469
### Enable commands in child shells (like in bash) ###

cmake/env/thisbdm.sh

100755100644
+45-6
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ _source_thisbdm()
109109
# silent->quiet
110110
export BDM_THISBDM_LOGLEVEL=0 # disable everything
111111
fi
112-
112+
113113
if [ "$BDM_THISBDM_LOGLEVEL" -le 2 ]; then
114114
export BDM_THISBDM_NOPROMPT=true
115115
else
@@ -135,7 +135,7 @@ _source_thisbdm()
135135
return 1
136136
fi
137137
########
138-
138+
139139
local old_bdmsys
140140
if [ -n "${BDMSYS}" ]; then
141141
old_bdmsys=${BDMSYS}
@@ -232,7 +232,7 @@ _source_thisbdm()
232232
LD_LIBRARY_PATH=$_newpath
233233
fi
234234
fi
235-
fi
235+
fi
236236

237237
# If we run on macOS, we add the following exports for libomp support
238238
if [ "$(uname)" = "Darwin" ]; then
@@ -542,6 +542,33 @@ _source_thisbdm()
542542
# OpenMP
543543
export OMP_PROC_BIND=true
544544

545+
#Select (export) the correct compiler version
546+
GCC_VER=$(gcc --version | grep gcc | awk '{print $NF}' | cut -d '.' -f 1-2)
547+
548+
if (echo "$GCC_VER >= 12" | bc -q > /dev/null) || (echo "$GCC_VER < 8" | bc -q > /dev/null); then
549+
550+
551+
if $(command -v gcc-11 > /dev/null) && $(command -v g++-11 > /dev/null) && $(command -v gfortran-11 > /dev/null); then
552+
553+
export CC=gcc-11
554+
export CXX=g++-11
555+
export FC=gfortran-11
556+
export OMPI_CC=gcc-11
557+
export OMPI_CXX=g++-11
558+
export OMPI_FC=gfortran-11
559+
560+
elif [ -d $BDMSYS/third_party/gcc ]; then
561+
562+
export CC=$BDMSYS/third_party/gcc/bin/gcc
563+
export CXX=$BDMSYS/third_party/gcc/bin/g++
564+
export FC=$BDMSYS/third_party/gcc/bin/gfortran
565+
export OMPI_CC=$BDMSYS/third_party/gcc/bin/gcc
566+
export OMPI_CXX=$BDMSYS/third_party/gcc/bin/g++
567+
export OMPI_FC=$BDMSYS/third_party/gcc/bin/gfortran
568+
569+
fi
570+
fi
571+
545572
###### Platform-specific Configuration
546573
# Apple specific
547574
if [ "$(uname)" = 'Darwin' ]; then
@@ -556,18 +583,27 @@ _source_thisbdm()
556583
if [ -z "${CXX}" ] && [ -z "${CC}" ] ; then
557584
. scl_source enable devtoolset-10 || return 1
558585
fi
559-
. /etc/profile.d/modules.sh || return 1
560-
module load mpi || return 1
561586

562587
# load llvm 6 required for libroadrunner
563588
if [ -d "${BDMSYS}"/third_party/libroadrunner ]; then
564589
. scl_source enable llvm-toolset-7 || return 1
565590
fi
566591
fi
567592
fi
593+
594+
#LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS
595+
if [ "$(uname)" = "Linux" ]; then
596+
# linux
597+
PROCVERSION=$(cat /proc/version)
598+
if echo "$PROCVERSION" | grep -Eiq 'Red Hat' ; then
599+
. /etc/profile.d/modules.sh || return 1
600+
module load mpi || return 1
601+
fi
602+
fi
603+
568604
#######
569605

570-
# completions for bash: really primitive (but useful nonetheless)
606+
# completions for bash: really primitive (but useful nonetheless)
571607
if [ -n "$BASH_VERSION" ]; then
572608
complete -W "new build clean run demo" biodynamo
573609
fi
@@ -625,6 +661,9 @@ _source_thisbdm()
625661
esac
626662
fi
627663

664+
665+
666+
628667
return 0
629668
}
630669

cmake/external/ParaView.cmake

+41-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,48 @@
11
include(utils)
22

33
SET(PARAVIEW_SOURCE_DIR "${CMAKE_THIRD_PARTY_DIR}/paraview")
4+
SET(PARAVIEW_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party")
45

5-
if(APPLE AND "${DETECTED_ARCH}" STREQUAL "i386")
6-
# The release of cmake 3.23.0 broke our build of ParaView on MacOSX.
7-
# The build was fixed with a reupload and carries the additional tag cm233.
8-
SET(PARAVIEW_TAR_FILE paraview_v5.10.0_cm323_${DETECTED_OS_VERS}_default.tar.gz)
9-
elseif(APPLE AND "${DETECTED_ARCH}" STREQUAL "arm64")
10-
SET(PARAVIEW_TAR_FILE paraview_v5.10.0_${DETECTED_OS_VERS}_default.tar.gz)
11-
else()
12-
SET(PARAVIEW_TAR_FILE paraview_v5.9.0_${DETECTED_OS_VERS}_default.tar.gz)
6+
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/build/third_party")
7+
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party")
138
endif()
14-
set(PARAVIEW_SHA_KEY ${DETECTED_OS_VERS}-ParaView)
15-
set(PARAVIEW_SHA ${${PARAVIEW_SHA_KEY}})
169

17-
message(STATUS "Using ParaView tarball : ${PARAVIEW_TAR_FILE}")
18-
message(STATUS "Using ParaView source dir : ${PARAVIEW_SOURCE_DIR}")
19-
message(STATUS "Using ParaView SHA key : ${PARAVIEW_SHA_KEY}")
20-
message(STATUS "Verify ParaView SHA : ${PARAVIEW_SHA}")
10+
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/paraview")
11+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/paraview" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
12+
#set(CMAKE_BDM_PVVERSION "5.11")
13+
14+
else()
15+
execute_process(COMMAND bash ${PARAVIEW_BLD_SCRIPT_LOCATION}/build-paraview_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE PARAVIEW_DOWNLOAD_OR_BUILD)
16+
if(${PARAVIEW_DOWNLOAD_OR_BUILD} EQUAL 1)
17+
if(APPLE AND "${DETECTED_ARCH}" STREQUAL "i386")
18+
# The release of cmake 3.23.0 broke our build of ParaView on MacOSX.
19+
# The build was fixed with a reupload and carries the additional tag cm233.
20+
SET(PARAVIEW_TAR_FILE paraview_v5.10.0_cm323_${DETECTED_OS_VERS}_default.tar.gz)
21+
elseif(APPLE AND "${DETECTED_ARCH}" STREQUAL "arm64")
22+
SET(PARAVIEW_TAR_FILE paraview_v5.10.0_${DETECTED_OS_VERS}_default.tar.gz)
23+
else()
24+
SET(PARAVIEW_TAR_FILE paraview_v5.9.0_${DETECTED_OS_VERS}_default.tar.gz)
25+
endif()
26+
set(PARAVIEW_SHA_KEY ${DETECTED_OS_VERS}-ParaView)
27+
set(PARAVIEW_SHA ${${PARAVIEW_SHA_KEY}})
28+
29+
message(STATUS "Using ParaView tarball : ${PARAVIEW_TAR_FILE}")
30+
message(STATUS "Using ParaView source dir : ${PARAVIEW_SOURCE_DIR}")
31+
message(STATUS "Using ParaView SHA key : ${PARAVIEW_SHA_KEY}")
32+
message(STATUS "Verify ParaView SHA : ${PARAVIEW_SHA}")
33+
34+
download_verify_extract(
35+
http://cern.ch/biodynamo-lfs/third-party/${PARAVIEW_TAR_FILE}
36+
${PARAVIEW_SOURCE_DIR}
37+
${PARAVIEW_SHA}
38+
)
2139

22-
download_verify_extract(
23-
http://cern.ch/biodynamo-lfs/third-party/${PARAVIEW_TAR_FILE}
24-
${PARAVIEW_SOURCE_DIR}
25-
${PARAVIEW_SHA}
26-
)
40+
if(${PARAVIEW_DOWNLOAD_OR_BUILD} EQUAL 0)
41+
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/build/third_party")
42+
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party")
43+
endif()
44+
file(COPY "${CMAKE_SOURCE_DIR}/third_party/paraview" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
45+
#set(CMAKE_BDM_PVVERSION "5.11")
46+
47+
endif()
48+
endif()

0 commit comments

Comments
 (0)