From 63babebbe4e11e84c938e797a75a6fedef2b9c28 Mon Sep 17 00:00:00 2001 From: Igor Sfiligoi Date: Fri, 15 Nov 2024 11:26:07 -0800 Subject: [PATCH] Add platform CONDA_OMPI_GNU --- platform/build/make.inc.CONDA_OMPI_GNU | 41 ++++++++++++++++++++++++++ platform/env/env.CONDA_OMPI_GNU | 28 ++++++++++++++++++ platform/exec/exec.CONDA_OMPI_GNU | 21 +++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 platform/build/make.inc.CONDA_OMPI_GNU create mode 100644 platform/env/env.CONDA_OMPI_GNU create mode 100755 platform/exec/exec.CONDA_OMPI_GNU diff --git a/platform/build/make.inc.CONDA_OMPI_GNU b/platform/build/make.inc.CONDA_OMPI_GNU new file mode 100644 index 000000000..157f8b818 --- /dev/null +++ b/platform/build/make.inc.CONDA_OMPI_GNU @@ -0,0 +1,41 @@ +# This platform assumes you have the environment fully from conda. +# It will compile with OpenMPI and gfortran. +# A single node setup is assumed (e.g. on a laptop, including Mac) +# +# Make sure you create a dedicated envoronment, and have +# at least the following is the packages installed: +# conda install -c conda-forge gfortran make python fftw openmpi netcdf4 +# More details in the env file + +MAKE = make +PREFIX = ${CONDA_PREFIX} +NETCDF_PATH=${PREFIX} +MF90 = mpif90 + +# Compilers and flags +# + +FC = ${MF90} -std=f2008 -fall-intrinsics -I$(GACODE_ROOT)/modules -J$(GACODE_ROOT)/modules -g -I${PREFIX}/include +F77 = ${MF90} -g + +FMATH = -fdefault-real-8 -fdefault-double-8 +FOPT = -O3 -m64 +FDEBUG = -Wall -fcheck=all -fbacktrace -fbounds-check -O0 -Wextra -finit-real=nan -Wunderflow -ffpe-trap=invalid,zero,overflow +FBOUND = -Wall -fbounds-check +FOMP = -fopenmp + +# System math libraries + +LMATH = -L${PREFIX}/lib -lfftw3 -llapack -lblas + +NETCDF = -L${PREFIX}/lib -lnetcdff -lnetcdf +NETCDF_INC =${PREFIX}/include + +# Archive + +ARCH = ar cr + +ifdef FANN_ROOT + # neural net libraries + NN_LIB=-L$(GACODE_ROOT)/../neural/ -I$(GACODE_ROOT)/../neural/ -lbrainfuse -L${PREFIX}/lib -lfann +endif diff --git a/platform/env/env.CONDA_OMPI_GNU b/platform/env/env.CONDA_OMPI_GNU new file mode 100644 index 000000000..986556a85 --- /dev/null +++ b/platform/env/env.CONDA_OMPI_GNU @@ -0,0 +1,28 @@ +# This platform assumes you have the environment fully from conda. +# Works on Mac, too. +# +# Make sure you create a dedicated envoronment, and have +# at least the following is the packages installed: +# conda install -c conda-forge gfortran make python fftw openmpi netcdf4 +# +# If you are new to conda, you can get everything setup by getting and running the installer from +# https://docs.anaconda.com/miniconda/ +# and then installing in a dedicated environment called "gacode" using the following command: +# conda create -n gacode -c conda-forge gfortran make python fftw openmpi netcdf4 +# conda activate gacode +# (you will need to do the activate after each login/shell startup) +# +if [ "x$GACODE_PLATFORM" != "xCONDA_OMPI_GNU" ]; then + echo "WARNING: Wrong GACODE_PLATFORM! ('$GACODE_PLATFORM' != 'CONDA_OMPI_GNU')" 2>&1 +elif [ "x$GACODE_ROOT" = "x" ]; then + echo "WARNING: GACODE_ROOT is not set" 2>&1 +elif [ ! -f $GACODE_ROOT/platform/env/env.CONDA_OMPI_GNU ]; then + echo "WARNING: GACODE_ROOT not properly set, cannot find env.CONDA_OMPI_GNU" 2>&1 +fi + +if [ ! -f $CONDA_PREFIX/include/fftw3.f03 ]; then + echo 'WARNING: Cound not find fftw3.f03 (expected in $CONDA_PREFIX/include/fftw3.f03' 2>&1 +elif [ "x$GACODE_PLATFORM" = "xCONDA_OMPI_GNU" ] && [ -f $GACODE_ROOT/platform/env/env.CONDA_OMPI_GNU ]; then + echo "INFO: Welcome to GACODE platform $GACODE_PLATFORM" 2>&1 +fi + diff --git a/platform/exec/exec.CONDA_OMPI_GNU b/platform/exec/exec.CONDA_OMPI_GNU new file mode 100755 index 000000000..384de6e9e --- /dev/null +++ b/platform/exec/exec.CONDA_OMPI_GNU @@ -0,0 +1,21 @@ +#!/bin/sh +# GACODE Parallel execution script + +simdir=${1} +nmpi=${2} +exec=${3} +nomp=${4} +numa=${5} +mpinuma=${6} + +# nmpi = MPI tasks +# nomp = OpenMP threads per MPI task + +cd $simdir + +export OMP_NUM_THREADS=$nomp +export OMP_STACKSIZE=400M + +echo ">mpirun -np $nmpi $exec" +mpirun -np $nmpi $exec +