Skip to content

Porting biodynamo to other linux platforms and others #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3305eef
This commit includes several changes:
johnpapad24 Mar 27, 2025
4092286
Just removed some dublicate warnings to the user.
johnpapad24 Mar 27, 2025
7cd7430
Just forgot to include the cython pip package for nest in centos 7
johnpapad24 Mar 27, 2025
d0f3d2a
Just forgot to include the cython pip package for nest in centos 7
johnpapad24 Mar 27, 2025
80fff87
a small bug fix
johnpapad24 Mar 27, 2025
34827e5
The script files that the initial commit ignored for some reason
johnpapad24 Mar 27, 2025
292ca54
another minor bug fix
johnpapad24 Mar 27, 2025
862b65b
add osx to offically supported distros
johnpapad24 Mar 27, 2025
377469f
add osx to offically supported distros-2
johnpapad24 Mar 27, 2025
0c34b3e
cython (nest requirement) for mac
johnpapad24 Mar 27, 2025
9ffe120
cython (nest requirement) for mac
johnpapad24 Mar 27, 2025
0ac11e5
another bugfix for macos-2
johnpapad24 Mar 27, 2025
e2e9a25
Removing mac os from specific supported OSes and modifyng paraview sc…
johnpapad24 Mar 27, 2025
cae9801
Removing mac os from specific supported OSes and modifyng paraview sc…
johnpapad24 Mar 27, 2025
5b03181
gcc-11 is available on mac os via brew
johnpapad24 Mar 29, 2025
2f5002a
changes to corectly support distros like almalinux 8 and correctly id…
johnpapad24 Mar 31, 2025
920d16f
fixed a small bug in mac os that terminated the script if gcc not found
johnpapad24 Mar 31, 2025
aa18730
fixing brewpy on mac os
johnpapad24 Mar 31, 2025
3a13f31
fixing brewpy on mac os-2
johnpapad24 Mar 31, 2025
90ec07b
mac os fixes again same as previous
johnpapad24 Mar 31, 2025
d57ed92
mac os fixes again same as previous
johnpapad24 Mar 31, 2025
f920673
fixes for centos/almalinux
johnpapad24 Apr 1, 2025
9048c63
a minor fix in qt
johnpapad24 Apr 1, 2025
6646fca
./install.sh./install.sh./install.sh./install.sh./install.sh./install…
johnpapad24 Apr 1, 2025
3214c78
fix for rhel 9
johnpapad24 Apr 1, 2025
4fe797e
fix for rhel 9
johnpapad24 Apr 1, 2025
1e13ce3
removal of legacy code for cent os 7 due to it's falsafe reimplementa…
johnpapad24 Apr 2, 2025
ad7da32
using custom brew formulae to install some depedencies on mac os UNTE…
johnpapad24 Apr 3, 2025
d48fb3a
using custom brew formulae to install some depedencies on mac os UNTE…
johnpapad24 Apr 3, 2025
a3ae87c
First install openmpi then install cmake
johnpapad24 Apr 3, 2025
f0e538b
repatch open-mpi formula to install version 4.0.7
johnpapad24 Apr 3, 2025
7c35d0f
repatch cmake.rb to build cmake without sphinx support
johnpapad24 Apr 5, 2025
5e2dc1e
testing fix for paraview in mac os
johnpapad24 Apr 16, 2025
35ee25d
incorporating fons changes
johnpapad24 Apr 16, 2025
277b895
disable building gcc on mac os
johnpapad24 Apr 16, 2025
70ef30f
forgot deepin support
johnpapad24 Apr 16, 2025
8531cf1
added osx back to supported distros
johnpapad24 Apr 16, 2025
1a12e42
fixes for mac os
johnpapad24 Apr 17, 2025
ee0845a
fixes for mac os
johnpapad24 Apr 17, 2025
71db37e
fixes for mac os
johnpapad24 Apr 17, 2025
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
28 changes: 26 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# -----------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.19.3 FATAL_ERROR)

set(policy_new CMP0072 CMP0077)
foreach(policy ${policy_new})
if(POLICY ${policy})
Expand Down Expand Up @@ -98,6 +97,7 @@ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_ROOT}/share")
set(CMAKE_INSTALL_CMAKEDATADIR "${CMAKE_INSTALL_DATADIR}/cmake")
set(CMAKE_INSTALL_THIRDPARTY "${CMAKE_INSTALL_ROOT}")


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

if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/gcc")
file(COPY "${CMAKE_SOURCE_DIR}/third_party/gcc" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
endif()


if(APPLE)
# ParaView on Apple devices
set(CMAKE_BDM_PVVERSION "5.10")
Expand Down Expand Up @@ -416,7 +422,15 @@ endif()

if(sbml)
if(APPLE)
message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).")
SET(LLRR_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party")
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner")
file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
else()
execute_process(COMMAND bash ${LLRR_BLD_SCRIPT_LOCATION}/build-roadrunner_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE LLRR_DOWNLOAD_OR_BUILD)
file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
endif()
find_package(Libroadrunner)
#message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).")
endif()
find_package(Libroadrunner)
if(NOT Libroadrunner_FOUND)
Expand All @@ -425,6 +439,16 @@ if(sbml)
endif()
endif()

if(nest)
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/nest")
file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
else()
SET(NEST_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party")
execute_process(COMMAND bash ${NEST_BLD_SCRIPT_LOCATION}/build-nest_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE NEST_DOWNLOAD_OR_BUILD)
file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party")
endif()
endif()

# Load libgit2 if it is enabled
if (libgit2)
include(external/Libgit2)
Expand Down
9 changes: 8 additions & 1 deletion cmake/FindROOT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
# dependencies in ROOT_GENERATE_DICTIONARY

if(NOT DEFINED ENV{ROOTSYS})
SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root")
elseif("$ENV{ROOTSYS}" STREQUAL "")
SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root")
endif()

find_program(ROOT_CONFIG_EXECUTABLE NAMES root-config
HINTS "$ENV{ROOTSYS}/bin" "$ENV{BDM_ROOT_DIR}/bin" "${CMAKE_THIRD_PARTY_DIR}/root/bin")



execute_process(
COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix
OUTPUT_VARIABLE ROOTSYS
Expand Down
46 changes: 36 additions & 10 deletions cmake/env/thisbdm.fish
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function source_thisbdm

set -l curr_filename (status --current-filename)
set -gx BDMSYS (fish -c "cd (dirname $curr_filename)/..; and pwd"); or return 1

if test -n "$old_bdmsys"; and test "$old_bdmsys" != "$BDMSYS"
_bdm_warn "[WARN] You've already sourced another 'thisbdm' in your current shell session."
_bdm_warn " -> prev. installation='$old_bdmsys'"
Expand Down Expand Up @@ -252,7 +252,7 @@ function source_thisbdm
end

pyenv init --path $PYENV_NO_REHASH | source; or return 1
pyenv init - $PYENV_NO_REHASH | source; or return 1
pyenv init - $PYENV_NO_REHASH | source; or return 1
pyenv shell @pythonvers@; or return 1

# Location of jupyter executable (installed with `pip install` command)
Expand All @@ -269,7 +269,7 @@ function source_thisbdm
end
########

#### ROOT Specific Configurations ####
#### ROOT Specific Configurations ####
if test -z "$BDM_CUSTOM_ROOT"
if test -z "$ROOTSYS"
set -gx BDM_CUSTOM_ROOT false
Expand All @@ -278,7 +278,7 @@ function source_thisbdm
end
end

if begin;
if begin;
test -z "$BDM_ROOT_DIR"; and test -z "$ROOTSYS";
end; or test "$BDM_CUSTOM_ROOT" = false
set -gx BDM_ROOT_DIR "$BDMSYS/third_party/root"
Expand Down Expand Up @@ -322,13 +322,13 @@ function source_thisbdm
set -gx BDM_CUSTOM_PV true
end
end

if test "$BDM_CUSTOM_PV" = false; or test -z "$ParaView_DIR"
set -gx ParaView_DIR "$BDMSYS/third_party/paraview"
else
_bdm_info "[INFO] Custom ParaView 'ParaView_DIR=$ParaView_DIR'"
end

if not test -d "$ParaView_DIR"
_bdm_err "[ERR] We are unable to find ParaView! Please make sure it is installed"
_bdm_err " on your system! You can manually specify its location by executing"
Expand Down Expand Up @@ -377,7 +377,7 @@ function source_thisbdm
set -gx BDM_CUSTOM_QT true
end
end

if test "$BDM_CUSTOM_QT" = false; or test -z "$Qt5_DIR"
set -gx Qt5_DIR "$BDMSYS/third_party/qt"
else
Expand Down Expand Up @@ -415,6 +415,26 @@ function source_thisbdm
# OpenMP
set -gx OMP_PROC_BIND true


#Select (export) the correct compiler version
if test (echo "$GCC_VER >= 12" | bc -q) -eq 1 || test (echo "$GCC_VER < 8" | bc -q) -eq 1
if command -q gcc-11 && command -q g++-11 && command -q gfortran-11
set -gx CC gcc-11
set -gx CXX g++-11
set -gx FC gfortran-11
set -gx OMPI_CC gcc-11
set -gx OMPI_CXX g++-11
set -gx OMPI_FC gfortran-11
else if test -d "$BDMSYS/third_party/gcc"
set -gx CC "$BDMSYS/third_party/gcc/bin/gcc"
set -gx CXX "$BDMSYS/third_party/gcc/bin/g++"
set -gx FC "$BDMSYS/third_party/gcc/bin/gfortran"
set -gx OMPI_CC "$BDMSYS/third_party/gcc/bin/gcc"
set -gx OMPI_CXX "$BDMSYS/third_party/gcc/bin/g++"
set -gx OMPI_FC "$BDMSYS/third_party/gcc/bin/gfortran"
end
end

###### Platform-specific Configuration
# Apple specific
if test (uname) = 'Darwin'
Expand All @@ -429,15 +449,21 @@ function source_thisbdm
. scl_source enable devtoolset-10; or return 1
end

. /etc/profile.d/modules.sh; or return 1
module load mpi; or return 1

# load llvm 6 required for libroadrunner
if test -d "$BDMSYS"/third_party/libroadrunner
. scl_source enable llvm-toolset-7; or return 1
end
end
end

#LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS
if test (uname) = "Linux"
set PROCVERSION (cat /proc/version)
if string match -iq '*Red Hat*' -- $PROCVERSION
source /etc/profile.d/modules.sh; or return 1
module load mpi; or return 1
end
end
#######

### Enable commands in child shells (like in bash) ###
Expand Down
92 changes: 82 additions & 10 deletions cmake/env/thisbdm.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ _source_thisbdm()
# silent->quiet
export BDM_THISBDM_LOGLEVEL=0 # disable everything
fi

if [ "$BDM_THISBDM_LOGLEVEL" -le 2 ]; then
export BDM_THISBDM_NOPROMPT=true
else
Expand All @@ -135,7 +135,7 @@ _source_thisbdm()
return 1
fi
########

local old_bdmsys
if [ -n "${BDMSYS}" ]; then
old_bdmsys=${BDMSYS}
Expand Down Expand Up @@ -232,7 +232,7 @@ _source_thisbdm()
LD_LIBRARY_PATH=$_newpath
fi
fi
fi
fi

# If we run on macOS, we add the following exports for libomp support
if [ "$(uname)" = "Darwin" ]; then
Expand Down Expand Up @@ -542,6 +542,7 @@ _source_thisbdm()
# OpenMP
export OMP_PROC_BIND=true


###### Platform-specific Configuration
# Apple specific
if [ "$(uname)" = 'Darwin' ]; then
Expand All @@ -553,21 +554,89 @@ _source_thisbdm()
os_id=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') || return 1
if [ "$os_id" = 'centos' ]; then
export MESA_GL_VERSION_OVERRIDE=3.3
if [ -z "${CXX}" ] && [ -z "${CC}" ] ; then
. scl_source enable devtoolset-10 || return 1
fi
. /etc/profile.d/modules.sh || return 1
module load mpi || return 1


# load llvm 6 required for libroadrunner
if [ -d "${BDMSYS}"/third_party/libroadrunner ]; then
. scl_source enable llvm-toolset-7 || return 1
fi
fi
fi

#LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS
if [ "$(uname)" = "Linux" ]; then
# linux
PROCVERSION=$(cat /proc/version)
if echo "$PROCVERSION" | grep -Eiq 'Red Hat' ; then
. scl_source enable gcc-toolset-10 > /dev/null 2> /dev/null || true
. scl_source enable devtoolset-10 > /dev/null 2> /dev/null || true
. scl_source enable gcc-toolset-11 > /dev/null 2> /dev/null || true
. scl_source enable devtoolset-11 > /dev/null 2> /dev/null || true
. /etc/profile.d/modules.sh || return 1
module load mpi || return 1
fi
fi

#Select (export) the correct compiler version
GCC_VER=$(gcc --version | grep gcc)
if [ -n "${GCC_VER}" ]; then
read -ra tokens <<< $GCC_VER
result=()
current_token=""
for token in "${tokens[@]}"; do
if [[ -n $current_token ]]; then
current_token+=" $token"
if [[ $current_token == *')' ]]; then
result+=("$current_token")
current_token=""
fi
else
if [[ $token == '('* && $token != *')' ]]; then
current_token="$token"
else
result+=("$token")
fi
fi
done
if [[ -n $current_token ]]; then
result+=("$current_token")
fi
GCC_VER=${result[2]}
GCC_VER=$( echo $GCC_VER | cut -d '.' -f 1-2)
fi

if [ -z "${GCC_VER}" ] || [ `echo "$GCC_VER >= 12" | bc -q` -ne 0 ] || [ `echo "$GCC_VER < 9" | bc -q` -ne 0 ]; then


if $(command -v gcc-11 > /dev/null) && $(command -v g++-11 > /dev/null) && $(command -v gfortran-11 > /dev/null); then

export CC=gcc-11
export CXX=g++-11
export FC=gfortran-11
export OMPI_CC=gcc-11
export OMPI_CXX=g++-11
export OMPI_FC=gfortran-11
export QMAKE_CC=gcc-11
export QMAKE_CXX=g++-11
export LINK=g++-11

elif [ -d $BDMSYS/third_party/gcc ]; then

export CC=$BDMSYS/third_party/gcc/bin/gcc
export CXX=$BDMSYS/third_party/gcc/bin/g++
export FC=$BDMSYS/third_party/gcc/bin/gfortran
export OMPI_CC=$BDMSYS/third_party/gcc/bin/gcc
export OMPI_CXX=$BDMSYS/third_party/gcc/bin/g++
export OMPI_FC=$BDMSYS/third_party/gcc/bin/gfortran
export QMAKE_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc
export QMAKE_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++
export LINK=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++

fi
fi

#######

# completions for bash: really primitive (but useful nonetheless)
# completions for bash: really primitive (but useful nonetheless)
if [ -n "$BASH_VERSION" ]; then
complete -W "new build clean run demo" biodynamo
fi
Expand Down Expand Up @@ -625,6 +694,9 @@ _source_thisbdm()
esac
fi




return 0
}

Expand Down
Loading
Loading