Skip to content

Commit

Permalink
spectral calculations for turbulence outupt
Browse files Browse the repository at this point in the history
  • Loading branch information
isriva committed Jan 26, 2024
1 parent ef07931 commit f671549
Show file tree
Hide file tree
Showing 8 changed files with 1,621 additions and 0 deletions.
65 changes: 65 additions & 0 deletions exec/compressible_stag/SPECTRAL_FILTER/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
AMREX_HOME ?= ../../../../amrex/

DEBUG = FALSE
USE_MPI = TRUE
USE_OMP = FALSE
USE_CUDA = FALSE
USE_HIP = FALSE
COMP = gnu
DIM = 3
TINY_PROFILE = FALSE

USE_HEFFTE_FFTW = FALSE
USE_HEFFTE_CUFFT = FALSE
USE_HEFFTE_ROCFFT = FALSE

ifeq ($(USE_HEFFTE_FFTW),TRUE)
HEFFTE_HOME ?= ../../../../heffte/
else ifeq ($(USE_HEFFTE_CUFFT),TRUE)
HEFFTE_HOME ?= ../../../../heffte/
else ifeq ($(USE_HEFFTE_ROCFFT),TRUE)
HEFFTE_HOME ?= ../../../../heffte/
endif

include $(AMREX_HOME)/Tools/GNUMake/Make.defs

VPATH_LOCATIONS += .
INCLUDE_LOCATIONS += .

ifeq ($(USE_HEFFTE_FFTW),TRUE)
include $(HEFFTE_HOME)/src/Make.package
else ifeq ($(USE_HEFFTE_CUFFT),TRUE)
include $(HEFFTE_HOME)/src/Make.package
else ifeq ($(USE_HEFFTE_ROCFFT),TRUE)
include $(HEFFTE_HOME)/src/Make.package
endif

include ./Make.package

include $(AMREX_HOME)/Src/Base/Make.package

include $(AMREX_HOME)/Tools/GNUMake/Make.rules

ifeq ($(USE_CUDA),TRUE)
LIBRARIES += -lcufft
else ifeq ($(USE_HIP),TRUE)
# Use rocFFT. ROC_PATH is defined in amrex
INCLUDE_LOCATIONS += $(ROC_PATH)/rocfft/include
LIBRARY_LOCATIONS += $(ROC_PATH)/rocfft/lib
LIBRARIES += -L$(ROC_PATH)/rocfft/lib -lrocfft
else
LIBRARIES += -L$(FFTW_DIR) -lfftw3_mpi -lfftw3 -lfftw3f
endif

ifeq ($(DO_TURB), TRUE)
DEFINES += -DTURB
endif

ifeq ($(USE_HEFFTE_FFTW),TRUE)
DEFINES += -DHEFFTE_FFTW
LIBRARIES += -L$(FFTW_DIR) -lfftw3_mpi -lfftw3 -lfftw3f
else ifeq ($(USE_HEFFTE_CUFFT),TRUE)
DEFINES += -DHEFFTE_CUFFT
else ifeq ($(USE_HEFFTE_ROCFFT),TRUE)
DEFINES += -DHEFFTE_ROCFFT
endif
5 changes: 5 additions & 0 deletions exec/compressible_stag/SPECTRAL_FILTER/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CEXE_sources += main.cpp
CEXE_sources += main_driver.cpp
CEXE_sources += spectral_functions.cpp

CEXE_headers += spectral_functions.H
30 changes: 30 additions & 0 deletions exec/compressible_stag/SPECTRAL_FILTER/build_perlmutter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/bash

# required dependencies
module load gpu
module load PrgEnv-gnu
module load craype
module load craype-x86-milan
module load craype-accel-nvidia80
module load cudatoolkit
module load cmake/3.24.3

# necessary to use CUDA-Aware MPI and run a job
export CRAY_ACCEL_TARGET=nvidia80

# optimize CUDA compilation for A100
export AMREX_CUDA_ARCH=8.0

# optimize CPU microarchitecture for AMD EPYC 3rd Gen (Milan/Zen3)
# note: the cc/CC/ftn wrappers below add those
export CXXFLAGS="-march=znver3"
export CFLAGS="-march=znver3"

# compiler environment hints
export CC=cc
export CXX=CC
export FC=ftn
export CUDACXX=$(which nvcc)
export CUDAHOSTCXX=CC

make -j10 USE_CUDA=TRUE USE_HEFFTE_CUFFT=TRUE USE_ASSERTION=TRUE
28 changes: 28 additions & 0 deletions exec/compressible_stag/SPECTRAL_FILTER/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <AMReX.H>
//#include <AMReX_ParmParse.H>

// function declaration
void main_driver (const char* argv);

int main (int argc, char* argv[])
{
amrex::Initialize(argc,argv);

// this specific part has been moved to Flagellum/main_driver.cpp
// {
// amrex::ParmParse pp("particles");
//#ifdef AMREX_USE_GPU
// bool particles_do_tiling = true;
//#else
// bool particles_do_tiling = false;
//#endif
// pp.queryAdd("do_tiling", particles_do_tiling);
// }

// argv[1] contains the name of the inputs file entered at the command line
main_driver(argv[1]);

amrex::Finalize();

return 0;
}
Loading

0 comments on commit f671549

Please sign in to comment.