This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pulled down changes made on Linux machine
- Loading branch information
Showing
11 changed files
with
359 additions
and
159 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Ignore everything | ||
| * | ||
| # Whitelist what is necessary | ||
| !setup.py | ||
| !version.txt | ||
| !environment.yml | ||
| !pyproject.toml | ||
| !requirements.txt | ||
| !distclean.cmake | ||
| !cmake/Modules/*.cmake | ||
| !CMakeLists.txt | ||
| !src/CMakeLists.txt | ||
| !swiftest/CMakeLists.txt | ||
| !swiftest/tests/CMakeLists.txt | ||
| !swiftest/*.py | ||
| !swiftest/*.pyx | ||
| !swiftest/*.h | ||
| !swiftest/tests/*.py | ||
| !src/*/*.f90 | ||
| !buildscripts/*.sh | ||
| !buildscripts/*.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| !*.sh | ||
| !*.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
| # This script will determine the steps necessary to set up an appropriate build environment necessary to build Swiftest and all its | ||
| # dependencies. The steps that are executed depend on the combination of platform and architecture, as follows: | ||
| # | ||
| # Linux amd64/x86_64: | ||
| # Docker present: The build scripts will run inside a Docker container with Intel compilers (preferred). | ||
| # Docker not present: The build scripts will run inside a custom conda environment and build with Intel compilers if available, | ||
| # or GNU compiler compilers otherwise. | ||
| # Linux aarch64/arm64: | ||
| # Docker present: The build scripts will run inside a Docker container with GNU compilers | ||
| # Docker not present: The build scripts will run inside a custom conda environment with GNU compilers | ||
| # Mac OS (Darwin): | ||
| # The build scripts will run inside a custom conda environment with GNU compilers | ||
| # | ||
| # Copyright 2023 - David Minton | ||
| # This file is part of Swiftest. | ||
| # Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
| # Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
| # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
| # You should have received a copy of the GNU General Public License along with Swiftest. | ||
| # If not, see: https://www.gnu.org/licenses. | ||
|
|
||
|
|
||
| # Determine the platform and architecture | ||
| SCRIPT_DIR=$(realpath $(dirname $0)) | ||
| ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) | ||
| BUILD_DIR=$(realpath ${ROOT_DIR}/build) | ||
| read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh) | ||
|
|
||
| # Determine if we are in the correct directory (the script can either be run from the Swiftest project root directory or the | ||
| # buildscripts directory) | ||
| if [ ! -f "${ROOT_DIR}/setup.py" ]; then | ||
| echo "Error: setup.py not found" | ||
| exit 1 | ||
| fi | ||
| cd ${ROOT_DIR} | ||
| VERSION=$( cat version.txt ) | ||
| echo "Building Swiftest version ${VERSION} for ${OS}-${ARCH}" | ||
|
|
||
| case $OS in | ||
| Linux) | ||
| # Determine if Docker is available | ||
| if command -v docker &> /dev/null; then | ||
| echo "Docker detected" | ||
| if [ "$ARCH" = "x86_64" ]; then | ||
| BUILDIMAGE="intel/oneapi-hpckit:2023.1.0-devel-ubuntu20.04" | ||
| else | ||
| BUILDIMAGE="condaforge/mambaforge:23.1.0-4" | ||
| fi | ||
| cmd="docker build --tag swiftest:latest --tag swiftest:${VERSION} --build-arg BUILDIMAGE=\"${BUILDIMAGE}\" ." | ||
| echo "Executing Docker build:\n${cmd}" | ||
| eval "$cmd" | ||
| exit 0 | ||
| else | ||
| echo "Docker not detected" | ||
| fi | ||
| ;; | ||
| MacOSX) | ||
| ;; | ||
| *) | ||
| echo "Swiftest is currently not configured to build for platform ${OS}-${ARCH}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| #!/bin/bash | ||
| # This script will build all of the dependency libraries needed by Swiftest. Builds the following from source: | ||
| # Zlib, hdf5, netcdf-c, netcdf-fortran | ||
| # | ||
| # Copyright 2023 - David Minton | ||
| # This file is part of Swiftest. | ||
| # Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
| # Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
| # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
| # You should have received a copy of the GNU General Public License along with Swiftest. | ||
| # If not, see: https://www.gnu.org/licenses. | ||
| SCRIPT_DIR=$(realpath $(dirname $0)) | ||
| BUILD_DIR=$(realpath ${SCRIPT_DIR}/../build) | ||
| mkdir -p ${BUILD_DIR} | ||
| cd $BUILD_DIR | ||
|
|
||
| USTMT="Usage: $0 <{Intel}|GNU>" | ||
| if [[ ( $@ == "--help") || $@ == "-h" ]]; then | ||
| echo $USTMT | ||
| exit 0 | ||
| fi | ||
| COMPILER=${1:-Intel} | ||
|
|
||
| case $COMPILER in | ||
| Intel) | ||
| if command -v ifx &> /dev/null; then | ||
| export FC=$(command -v ifx) | ||
| export CC=$(command -v icx) | ||
| export CXX=$(command -v icpx) | ||
| elif command -v ifort &> /dev/null; then | ||
| export FC=$(command -v ifort) | ||
| export CC=$(command -v icc) | ||
| export CXX=$(command -v icpc) | ||
| else | ||
| echo "Error. Cannot find valid Intel fortran compiler." | ||
| exit 1 | ||
| fi | ||
| export F77="${FC}" | ||
| ;; | ||
| GNU) | ||
| export FC=$(command -v gfortran) | ||
| export CC=$(command -v gcc) | ||
| export CXX=$(command -v g++) | ||
| ;; | ||
| *) | ||
| echo "Unknown compiler type: ${COMPILER}" | ||
| echo $USTMT | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| export F77=${FC} | ||
| echo "Using $COMPILER compilers:\nFC: $FC\nCC: $CC\nCXX: $CXX\n" | ||
|
|
||
| export INSTALL_DIR=${BUILD_DIR} | ||
| mkdir -p ${INSTALL_DIR} | ||
| export NCDIR="${INSTALL_DIR}" | ||
| export NFDIR="${INSTALL_DIR}" | ||
| export HDF5_ROOT="${INSTALL_DIR}" | ||
| export HDF5_LIBDIR="${HDF5_ROOT}/lib" | ||
| export HDF5_INCLUDE_DIR="${HDF5_ROOT}/include" | ||
| export HDF5_PLUGIN_PATH="${HDF5_LIBDIR}/plugin" | ||
|
|
||
| export LDFLAGS="-L${INSTALL_DIR}/lib" | ||
| export CPATH="${INSTALL_DIR}/include" | ||
| export CFLAGS="-fPIC" | ||
|
|
||
| cd zlib-1.2.13 | ||
| ./configure --prefix=${INSTALL_DIR} --static | ||
| make | ||
| make install | ||
| cd ../hdf5-1.14.1-2 | ||
| ./configure --disable-shared \ | ||
| --enable-build-mode=production \ | ||
| --disable-fortran \ | ||
| --disable-java \ | ||
| --disable-cxx \ | ||
| --prefix=${INSTALL_DIR} \ | ||
| --with-zlib=${INSTALL_DIR} | ||
| make | ||
| make install | ||
|
|
||
| cd ../netcdf-c-4.9.2 | ||
| ./configure --disable-shared \ | ||
| --disable-dap \ | ||
| --disable-byterange \ | ||
| --prefix=${INSTALL_DIR} | ||
| make | ||
| make check | ||
| make install | ||
|
|
||
| if [ $COMPILER = "Intel" ]; then | ||
| export FCFLAGS="${CFLAGS} -standard-semantics" | ||
| export FFLAGS=${CFLAGS} | ||
| else | ||
| export FCFLAGS="${CFLAGS}" | ||
| export FFLAGS="${CFLAGS}" | ||
| fi | ||
|
|
||
| export LIBS="$(${INSTALL_DIR}/bin/nc-config --libs)" | ||
| cd ../netcdf-fortran-4.6.1 | ||
| ./configure --disable-shared --with-pic --prefix=${NFDIR} | ||
| make | ||
| make check | ||
| make install |
Oops, something went wrong.