Skip to content
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

Added build and instructions for Pixi environment manager #414

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
73 changes: 73 additions & 0 deletions platform/build/make.inc.PIXI_MPICH
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#---------------------------------------------------
# OSX, Linux mpich using pixi
#
# 1. Install Pixi
# curl -fsSL https://pixi.sh/install.sh | bash
#
# 2. Restart shell / terminal / console for Pixi to be recognized
#
# 3. Create Pixi environment
# pixi init <env_name>
#
# 4. Setup Pixi environment
# cd <env_name>
# git clone [email protected]:gafusion/gacode.git
# pixi add "python~=3.12,<3.13"
# pixi add git
# pixi add mpich
# pixi add gfortran
# pixi add openblas
# pixi add "libopenblas=*=*openmp*"
# pixi add liblapack
# pixi add fftw
# pixi add hdf5
# pixi add netcdf-fortran
#
# 5. Enter and configure Pixi environment (must be repeated every entry)
# pixi shell
# export GACODE_ROOT=${PIXI_PROJECT_ROOT}/gacode
# export GACODE_PLATFORM=PIXI_MPICH
# source ${GACODE_ROOT}/shared/bin/gacode_setup
#
# 6. Build GACODE
# cd gacode
# make
# cd ..
#
# 7. Run regression tests
# neo -r
# tglf -r
# cgyro -r -n 4 -nomp 2
# tgyro -r -n 4
#
#---------------------------------------------------

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 -fallow-argument-mismatch
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

# Optional netCDF libraries

NETCDF = -L${PREFIX}/lib -lnetcdff -lnetcdf
NETCDF_INC = ${PREFIX}/include

# Archive

ARCH = ar cr

73 changes: 73 additions & 0 deletions platform/build/make.inc.PIXI_OPENMP
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#---------------------------------------------------
# OSX, Linux mpich using pixi
#
# 1. Install Pixi
# curl -fsSL https://pixi.sh/install.sh | bash
#
# 2. Restart shell / terminal / console for Pixi to be recognized
#
# 3. Create Pixi environment
# pixi init <env_name>
#
# 4. Setup Pixi environment
# cd <env_name>
# git clone [email protected]:gafusion/gacode.git
# pixi add "python~=3.12,<3.13"
# pixi add git
# pixi add openmpi-mpifort
# pixi add gfortran
# pixi add openblas
# pixi add "libopenblas=*=*openmp*"
# pixi add liblapack
# pixi add fftw
# pixi add hdf5
# pixi add netcdf-fortran
#
# 5. Enter and configure Pixi environment (must be repeated every entry)
# pixi shell
# export GACODE_ROOT=${PIXI_PROJECT_ROOT}/gacode
# export GACODE_PLATFORM=PIXI_OPENMPI
# source ${GACODE_ROOT}/shared/bin/gacode_setup
#
# 6. Build GACODE
# cd gacode
# make
# cd ..
#
# 7. Run regression tests
# neo -r
# tglf -r
# cgyro -r -n 4 -nomp 2
# tgyro -r -n 4
#
#---------------------------------------------------

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 -fallow-argument-mismatch
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

# Optional netCDF libraries

NETCDF = -L${PREFIX}/lib -lnetcdff -lnetcdf
NETCDF_INC = ${PREFIX}/include

# Archive

ARCH = ar cr

2 changes: 2 additions & 0 deletions platform/env/env.PIXI_MPICH
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The PIXI platform assumes that you have installed pixi and run the
# appropriate commands to have the virtual environment set up well.
2 changes: 2 additions & 0 deletions platform/env/env.PIXI_OPENMP
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The PIXI platform assumes that you have installed pixi and run the
# appropriate commands to have the virtual environment set up well.
19 changes: 19 additions & 0 deletions platform/exec/exec.PIXI_MPICH
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# GACODE Parallel execution script (PIXI)
#
# NOTES:
# Used mpich2-1.0.1, so use mpirun rather than mpiexec

simdir=${1}
nmpi=${2}
exec=${3}
nomp=${4}
numa=${5}
mpinuma=${6}

echo $simdir

cd $simdir

mpirun -env OMP_NUM_THREADS $nomp -np $nmpi $exec

19 changes: 19 additions & 0 deletions platform/exec/exec.PIXI_OPENMP
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# GACODE Parallel execution script (PIXI_OPENMP)
#
# NOTES:
# Used openmpi-5.0.1

simdir=${1}
nmpi=${2}
exec=${3}
nomp=${4}
numa=${5}
mpinuma=${6}

echo $simdir

cd $simdir

mpirun -x OMP_NUM_THREADS=$nomp -np $nmpi --oversubscribe $exec