From b6cbb861a1815373c756efdae14e5c8ff6758460 Mon Sep 17 00:00:00 2001 From: Antonello Zito <104907035+antonellozito@users.noreply.github.com> Date: Tue, 7 Jan 2025 22:27:40 +0100 Subject: [PATCH] Added config files adapted to Brew libraries for MacOS (#432) Co-authored-by: Antonello Zito --- platform/build/make.inc.GFORTRAN_OSX_BREW | 37 +++++++++++++++++++++++ platform/env/env.GFORTRAN_OSX_BREW | 6 ++++ platform/exec/exec.GFORTRAN_OSX_BREW | 17 +++++++++++ 3 files changed, 60 insertions(+) create mode 100644 platform/build/make.inc.GFORTRAN_OSX_BREW create mode 100644 platform/env/env.GFORTRAN_OSX_BREW create mode 100755 platform/exec/exec.GFORTRAN_OSX_BREW diff --git a/platform/build/make.inc.GFORTRAN_OSX_BREW b/platform/build/make.inc.GFORTRAN_OSX_BREW new file mode 100644 index 000000000..78755cae4 --- /dev/null +++ b/platform/build/make.inc.GFORTRAN_OSX_BREW @@ -0,0 +1,37 @@ +#--------------------------------------------------- +# OSX,gfortran+openmpi from Homebrew +# +# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +# brew install gcc open-mpi netcdf netcdf-fortran fftw +#--------------------------------------------------- + +IDENTITY="OSX gfortran+openmpi from Homebrew" + +MAKE = make + +MF90 = mpif90 + +# Compilers and flags + +FC = ${MF90} -std=f2008 -fall-intrinsics -I$(FFTW_INC) -I$(GACODE_ROOT)/modules -J$(GACODE_ROOT)/modules -I/opt/local/include -fPIC +F77 = ${MF90} -w -fallow-argument-mismatch + +FOMP = -fopenmp +FMATH = -fdefault-real-8 -fdefault-double-8 +FOPT = -O3 -m64 -framework Accelerate +FDEBUG = -Wall -g -fcheck=all -fbacktrace -fbounds-check -O0 -Wextra -finit-real=nan -Wunderflow -ffpe-trap=invalid,zero,overflow +#F2PY = f2py-2.7 + +# System libraries + +LMATH = -L$(BREW_LIB) -lfftw3 +NETCDF = -L$(BREW_LIB) -lnetcdff -lnetcdf + +# Archive + +ARCH = ar cr + +ifdef FANN_ROOT + # neural net libraries + NN_LIB=-L$(GACODE_ROOT)/../neural/ -I$(GACODE_ROOT)/../neural/ -lbrainfuse -lfann +endif diff --git a/platform/env/env.GFORTRAN_OSX_BREW b/platform/env/env.GFORTRAN_OSX_BREW new file mode 100644 index 000000000..a2c50a7f2 --- /dev/null +++ b/platform/env/env.GFORTRAN_OSX_BREW @@ -0,0 +1,6 @@ +#!/bin/sh + +export BREW_LIB=$(brew --prefix)/lib +export LD_LIBRARY_PATH=$(brew --prefix)/lib:$LD_LIBRARY_PATH +export FFTW_INC=$(brew --prefix fftw)/include +export NETCDF_INC=$(brew --prefix netcdf)/include diff --git a/platform/exec/exec.GFORTRAN_OSX_BREW b/platform/exec/exec.GFORTRAN_OSX_BREW new file mode 100755 index 000000000..7f4520a23 --- /dev/null +++ b/platform/exec/exec.GFORTRAN_OSX_BREW @@ -0,0 +1,17 @@ +#!/bin/sh +# GACODE Parallel execution script (GFORTRAN_OSX_MACPORTS) +# +# NOTES: +# Used mpich2-1.0.3, so use mpirun rather than mpiexec + +simdir=${1} +nmpi=${2} +exec=${3} +nomp=${4} +numa=${5} +mpinuma=${6} + +echo $simdir + +cd $simdir +export OMP_NUM_THREADS=$nomp ; mpiexec --oversubscribe -np $nmpi $exec