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

Phoenix Runner #41

Merged
merged 54 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ae29675
reset
suzanmanasreh Jun 20, 2024
05b7a58
reorder
suzanmanasreh Jun 20, 2024
f40ace8
Update CMakeLists.txt
suzanmanasreh Jun 20, 2024
403fc8d
dry
suzanmanasreh Jun 20, 2024
b06b44d
Update readme.md
suzanmanasreh Jun 20, 2024
5f85526
rm line
suzanmanasreh Jun 20, 2024
fcbcd36
Merge branch 'newbranch' of https://github.com/comp-physics/RBC3D int…
suzanmanasreh Jun 20, 2024
bbea8ab
new info
suzanmanasreh Jun 20, 2024
35c101c
support ml petsc
suzanmanasreh Jun 20, 2024
b84a143
mdf90 fix
suzanmanasreh Jun 21, 2024
900e087
rm
suzanmanasreh Jun 21, 2024
7e68bec
remove prints
suzanmanasreh Jun 21, 2024
ffb5b8b
see runner
suzanmanasreh Jun 22, 2024
ab361b5
?
suzanmanasreh Jun 22, 2024
3a09e83
0
suzanmanasreh Jun 22, 2024
6a3284e
fix arg
suzanmanasreh Jun 22, 2024
368aba4
:
suzanmanasreh Jun 22, 2024
34bc5c7
error notice
suzanmanasreh Jun 22, 2024
a75c2f0
ompi
suzanmanasreh Jun 22, 2024
05b3878
out
suzanmanasreh Jun 22, 2024
9c1aede
configure.log
suzanmanasreh Jun 22, 2024
1bc6e34
see configure.log
suzanmanasreh Jun 22, 2024
8076b0d
better place
suzanmanasreh Jun 22, 2024
06afc9e
path
suzanmanasreh Jun 22, 2024
93c703e
diff mvapich2
suzanmanasreh Jun 22, 2024
751d097
change
suzanmanasreh Jun 22, 2024
f047a1e
gcc
suzanmanasreh Jun 22, 2024
2e94000
mkl
suzanmanasreh Jun 22, 2024
24f3dcb
mklroot
suzanmanasreh Jun 22, 2024
935fd93
lapack
suzanmanasreh Jun 22, 2024
a8ada3d
fftw
suzanmanasreh Jun 22, 2024
e8da17e
cmake
suzanmanasreh Jun 22, 2024
75a65b7
conflict?
suzanmanasreh Jun 22, 2024
722c484
yml
suzanmanasreh Jun 22, 2024
822db38
make case
suzanmanasreh Jun 22, 2024
b92c270
u
suzanmanasreh Jun 22, 2024
3e4bebd
l
suzanmanasreh Jun 22, 2024
303fd91
:
suzanmanasreh Jun 22, 2024
b388007
rm fftw
suzanmanasreh Jun 22, 2024
6f165c3
export fftw
suzanmanasreh Jun 22, 2024
786d8da
include handle
suzanmanasreh Jun 22, 2024
dab80e1
fix condition
suzanmanasreh Jun 22, 2024
b400280
cmake
suzanmanasreh Jun 22, 2024
7190990
typos
suzanmanasreh Jun 22, 2024
51ae5ad
libaries
suzanmanasreh Jun 22, 2024
265ca9c
clean up
suzanmanasreh Jun 22, 2024
7c10063
duplicate
suzanmanasreh Jun 22, 2024
b11443a
spherocytes
suzanmanasreh Jun 22, 2024
6dda003
Update readme.md
suzanmanasreh Jun 22, 2024
813eced
Update readme.md
suzanmanasreh Jun 22, 2024
6aca45f
see spherepack
suzanmanasreh Jun 23, 2024
fb4638a
Update README.md
suzanmanasreh Jun 23, 2024
86f9b9c
Update Makefile.in
suzanmanasreh Jun 24, 2024
c792664
Update ModIntOnWalls.F90
suzanmanasreh Jun 24, 2024
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
34 changes: 11 additions & 23 deletions .github/workflows/ice.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: 'Test on ICE'

on:
push:
pull_request:
workflow_dispatch:

Expand All @@ -17,32 +16,21 @@ jobs:
uses: actions/checkout@v4

# use mkl option
- name: Build
- name: Build Packages
run: |
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 python/3.10.10 netcdf-c/4.9.2-mva2-hdf5-1.14 netcdf-cxx/4.2-mva2-hdf5-1.14 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva
bash rbc.sh install-with-mkl
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva cmake
./rbc.sh install

# will stop on any errors
- name: Compile Common
- name: Compile Cases
run: |
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 python/3.10.10 netcdf-c/4.9.2-mva2-hdf5-1.14 netcdf-cxx/4.2-mva2-hdf5-1.14 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva cmake
set -e -x
cd common
make .depend
export PETSC_DIR=`pwd`/packages/petsc-3.19.6
export PETSC_ARCH=arch-linux-c-opt
mkdir build
cd build
cmake ..
make
echo "/common compiled successfully!"
echo "/common and all cases in /examples compiled successfully!"

- name: Compile Example Cases
run: |
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 python/3.10.10 netcdf-c/4.9.2-mva2-hdf5-1.14 netcdf-cxx/4.2-mva2-hdf5-1.14 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva
set -e -x
base_dir="examples"

cases=$(find "$base_dir" -maxdepth 1 -type d ! -path "$base_dir")

for case in $cases; do
make -C "$case" .depend
make -C "$case"
done

echo "All cases in /examples compiled successfully!"
49 changes: 49 additions & 0 deletions .github/workflows/phoenix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'Test on Phoenix'

on:
pull_request:
workflow_dispatch:

jobs:
self:
name: Phoenix Runner
runs-on:
labels: gt
if: github.repository == 'Comp-Physics/RBC3D'
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Packages
run: |
ml gcc/12.1.0-qgxpzk mvapich2/2.3.7-733lcv
./rbc.sh install-phoenix

- name: Make Case with Makefiles
run: |
ml gcc/12.1.0-qgxpzk mvapich2/2.3.7-733lcv netcdf-fortran cmake
set -e -x
export FFTWROOT=`pwd`/packages/fftw-3.3.10/build
export PETSC_DIR=`pwd`/packages/petsc-3.19.6
export PETSC_ARCH=arch-linux-c-opt
cd common
make .depend
make
cd ../examples/case
make .depend
make
echo "/common and case compiled successfully!"

- name: Compile Cases with CMake
run: |
ml gcc/12.1.0-qgxpzk mvapich2/2.3.7-733lcv netcdf-fortran cmake
set -e -x
export PETSC_DIR=`pwd`/packages/petsc-3.19.6
export PETSC_ARCH=arch-linux-c-opt
mkdir build
cd build
cmake ..
make
echo "/common and all cases in /examples compiled successfully!"

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ tube
libcommon.a
.vscode
field
packages
packages*
traction
build
167 changes: 167 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# To generate build files for common and all example cases:
# mkdir build
# cd build
# cmake ..
# make
# Regenerate case files after changes:
# cmake .
# make case
# Show each build command line as it is launched
# cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
# See compile commands in build directory
# cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

include(CMakePrintHelpers)
cmake_minimum_required(VERSION 3.20)

project(RBC3D LANGUAGES Fortran C CXX)

set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(USE_MKL OFF)

if (DEFINED ENV{MKLROOT})
set(USE_MKL ON)
message("Using MKL lapack because MKLROOT=$ENV{MKLROOT}")
# use mkl implementation of lapack
set(BLA_VENDOR Intel10_64lp)
endif()

if (NOT DEFINED ENV{PETSC_DIR})
message(FATAL_ERROR "PETSc environment variables are not set. Please export PETSC_DIR.")
endif()

if (NOT DEFINED ENV{PETSC_ARCH})
# PETSC_ARCH is not part of PETSc module
message(WARNING "PETSC_ARCH is not set. Please export PETSC_ARCH if using manually installed PETSc package.")
set(PETSC $ENV{PETSC_DIR})
else ()
# full path if PETSC_DIR and PETSC_ARCH env variables are set
set(PETSC $ENV{PETSC_DIR}/$ENV{PETSC_ARCH})
endif()

set(ENV{PKG_CONFIG_PATH} ${PETSC}/lib/pkgconfig)

cmake_print_variables(PETSC)

# use the same fortran compiler petsc was configured with
execute_process (COMMAND pkg-config PETSc --variable=fcompiler COMMAND tr -d '\n' OUTPUT_VARIABLE FORTRAN_COMPILER)
cmake_print_variables(FORTRAN_COMPILER)

if (FORTRAN_COMPILER)
set(CMAKE_Fortran_COMPILER ${FORTRAN_COMPILER})
# same compile options as Makefile.in
add_compile_options(-fallow-argument-mismatch -freal-4-real-8 -O3)
add_link_options(-ldl -lstdc++ -Wl,--copy-dt-needed-entries)
else ()
message(FATAL_ERROR "PETSc Fortran compiler not found. Please ensure PETSc was configured with a Fortran compiler.")
endif (FORTRAN_COMPILER)

find_package(PkgConfig REQUIRED)

if (PKG_CONFIG_FOUND)
pkg_check_modules(PETSC PETSc)
else()
message(FATAL_ERROR "PkgConfig was not found.")
endif()

if (NOT PETSC_FOUND)
message(FATAL_ERROR "PETSc was not found through PkgConfig.")
else()
if (NOT DEFINED ENV{PETSC_ARCH})
# not having PETSC_ARCH set makes include dirs null for some reason
set(PETSC_INCLUDE_DIRS "$ENV{PETSC_DIR}/include")
endif()
endif()

if (LAPACK_FOUND)
message(STATUS "LAPACK libraries: ${LAPACK_LIBRARIES}")
elseif(NOT USE_MKL)
# LAPACK_LIBRARIES doesn't need to be set if MKL is module loaded
set(LAPACK_LIBRARIES "-L${CMAKE_CURRENT_SOURCE_DIR}/packages/lapack-3.11 -llapack -lrefblas")
cmake_print_variables(LAPACK_LIBRARIES)
endif(LAPACK_FOUND)

# look for FFTWROOT or FFTW_ROOT
if (DEFINED ENV{FFTWROOT})
set(FFTW_INCLUDE "$ENV{FFTWROOT}/include")
set(FFTW_LIB "-L$ENV{FFTWROOT}/lib -lfftw3")
elseif(DEFINED ENV{FFTWROOT})
set(FFTW_INCLUDE "$ENV{FFTW_ROOT}/include")
set(FFTW_LIB "-L$ENV{FFTW_ROOT}/lib -lfftw3")
else ()
message(WARNING "FFTWROOT and FFTW_ROOT environment variables from module load fftw not found. Assuming you installed FFTW in packages.")
set(FFTW_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/packages/fftw-3.3.10/build/include")
set(FFTW_LIB "-L${CMAKE_CURRENT_SOURCE_DIR}/packages/fftw-3.3.10/build/lib -lfftw3")
endif()

# look for NETCDF_FORTRANROOT or NETCDF_FORTRAN_ROOT
if (DEFINED ENV{NETCDF_FORTRANROOT})
set(NETCDF_INCLUDE "$ENV{NETCDF_FORTRANROOT}/include")
set(NETCDF_LIB "-L$ENV{NETCDF_FORTRANROOT}/lib -lnetcdff")
elseif (DEFINED ENV{NETCDF_FORTRAN_ROOT})
set(NETCDF_INCLUDE "$ENV{NETCDF_FORTRAN_ROOT}/include")
set(NETCDF_LIB "-L$ENV{NETCDF_FORTRAN_ROOT}/lib -lnetcdff")
else ()
message(FATAL_ERROR "NETCDF_FORTRANROOT or NETCDF_FORTRAN_ROOT environment variables not found. Please module load netcdf-fortran.")
endif()

# spherepack library
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/packages/spherepack3.2/lib")
set(SPHPK_LIB "-L${CMAKE_CURRENT_SOURCE_DIR}/packages/spherepack3.2/lib -lspherepack")
else()
message(FATAL_ERROR "Spherepack is not installed in ${CMAKE_CURRENT_SOURCE_DIR}/packages/spherepack3.2")
endif()

# build common
add_subdirectory(common)
install(TARGETS common LIBRARY DESTINATION "bin")

include_directories("${CMAKE_CURRENT_BINARY_DIR}/common")

set(examples_dir "examples")

# glob for the directories in /examples
file(GLOB examples_list RELATIVE ${CMAKE_SOURCE_DIR}/${examples_dir} ${CMAKE_SOURCE_DIR}/${examples_dir}/*)
set(dirlist "")
foreach (example ${examples_list})
if (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${examples_dir}/${example})
list(APPEND dirlist ${example})
endif()
endforeach()

cmake_print_variables(LAPACK_LIBRARIES)

foreach (casedir ${dirlist})

# make binary dir inside /build for case executables
set(case_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${casedir}")
file(MAKE_DIRECTORY ${case_binary_dir})
# copy input directory to case binary dir and create D directory
make_directory("${case_binary_dir}/D")
file(GLOB inputs "${CMAKE_CURRENT_SOURCE_DIR}/${examples_dir}/${casedir}/Input/*")
file(COPY ${inputs} DESTINATION "${case_binary_dir}/Input")

# find all F90 files in the examples/case directory
file(GLOB case_F90s "${CMAKE_CURRENT_SOURCE_DIR}/${examples_dir}/${casedir}/*.F90")

# create a custom target with the name of the current case directory
add_custom_target(${casedir})

# loop through each F90 file
foreach(F90_filepath ${case_F90s})
# get the file name without extension
get_filename_component(file_target ${F90_filepath} NAME_WE)
add_executable(${file_target} ${F90_filepath})

# add each target to its own case build directory
set_target_properties(${file_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${case_binary_dir})

# set include directories and link libraries
# petsc might not be necessary for all files (i.e. initcond) but it doesn't hurt to add it
target_include_directories(${file_target} PRIVATE ${PETSC_INCLUDE_DIRS})
target_link_libraries(${file_target} PRIVATE ${LAPACK_LIBRARIES} common ${PETSC_LINK_LIBRARIES})

# add dependency to the custom target
add_dependencies(${casedir} ${file_target})
endforeach()
endforeach()
7 changes: 6 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ vpath $(WORK_DIR)/common
PETSC_INCLUDE = $(PETSC_DIR)/include
PETSC_ARCH_INCLUDE = $(PETSC_ARCH)/include
NETCDF_INCLUDE = $(NETCDF_FORTRANROOT)/include
# If you installed FFTW in packages through install/install-phoenix.sh
# run: export FFTWROOT=`pwd`/packages/fftw-3.3.10/build from RBC3D root directory in terminal
# or make a variable in this file
FFTW_INCLUDE = $(FFTWROOT)/include

COMMON_INCLUDE = -I$(WORK_DIR)/common
INCLUDE = $(COMMON_INCLUDE) -I$(PETSC_INCLUDE) -I$(PETSC_ARCH_INCLUDE) -I$(NETCDF_INCLUDE)
# you can remove -I$(FFTW_INCLUDE) if you module loaded fftw
INCLUDE = $(COMMON_INCLUDE) -I$(PETSC_INCLUDE) -I$(PETSC_ARCH_INCLUDE) -I$(NETCDF_INCLUDE) -I$(FFTW_INCLUDE)

# Libraries
COMMON_LIB = $(WORK_DIR)/common/libcommon.a
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,43 @@ This codebase solves the boundary integral form of the Stokes equations via an a
To install on PACE Phoenix, you need to salloc a node to make sure srun is available and then run this in the RBC3D root directory:

```shell
ml gcc mvapich2 mkl python/3.9.12-rkxvr6 netcdf-c netcdf-cxx netcdf-fortran fftw
bash rbc.sh install-with-mkl
ml gcc/12.1.0-qgxpzk mvapich2/2.3.7-733lcv python/3.9.12-rkxvr6 netcdf-fortran cmake
./rbc.sh install-phoenix
```

Note that if the `gcc`, `mvapich2`, `mkl`, and `fftw` modules work on your Phoenix account, you should use this installer script for a faster build.
```shell
ml gcc mvapich2 mkl python/3.9.12-rkxvr6 netcdf-fortran fftw cmake
./rbc.sh install
```

Or if you're on COC-ICE, you just need to load different modules to run the installer script.

```shell
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 python/3.10.10 netcdf-c/4.9.2-mva2-hdf5-1.14 netcdf-cxx/4.2-mva2-hdf5-1.14 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva2
bash rbc.sh install-with-mkl
ml gcc/12.3.0 mvapich2/2.3.7-1 intel-oneapi-mkl/2023.1.0 python/3.10.10 netcdf-fortran/4.6.0-mva2-hdf5-1.14 fftw/3.3.10-mva2 cmake
./rbc.sh install
```

Before you can run cmake, you must set these environment variables. You can place them in your `~/.bashrc`. If you didn't place `RBC3D` in your `$HOME` directory, then replace it with where you placed `RBC3D`.
```shell
export PETSC_DIR=$HOME/RBC3D/packages/petsc-3.19.6
export PETSC_ARCH=arch-linux-c-opt
```

Then to execute and run a case, you can:
```shell
cd common
make .depend
make
cd ..examples/case
make .depend
make
mkdir build
cd build
cmake ..
make case # or just `make` to make common and all the cases
cd case
srun -n 1 ./initcond
srun ./tube
```

On other supercomputing clusters, it should be easy to replace the module loads with the modules available on your system and change the directories in `Makefile.in` to point to those modules. If one of these isn't available, you can follow the manual build instructions [available here](https://github.com/comp-physics/RBC3D/blob/master/install/readme.md).
This will generate output files in `build/case/D`. To keep output files in `examples/case/D`, you can `cd examples/case` and `srun ../../build/case/initcond` and same for tube.

On other supercomputing clusters, it should be easy to replace the module loads with the modules available on your system. If one of these isn't available, you can follow the manual build instructions [available here](https://github.com/comp-physics/RBC3D/blob/master/install/readme.md).

### Papers that use RBC3D

Expand Down
6 changes: 6 additions & 0 deletions common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file(GLOB common_F90s "*.F90")
add_library(common STATIC "${common_F90s}")

target_include_directories(common PRIVATE ${PETSC_INCLUDE_DIRS} ${NETCDF_INCLUDE} ${FFTW_INCLUDE})
target_link_libraries(common ${LAPACK_LIBRARIES} ${PETSC_LINK_LIBRARIES} ${SPHPK_LIB} ${FFTW_LIB} ${NETCDF_LIB})

2 changes: 1 addition & 1 deletion common/ModIntOnWalls.F90
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ subroutine PrepareSingIntOnWall(wall)
end do ! i

! nnz = nnz*2 ! a very conservative estimate
nnz = nnz*12 ! a very conservative estimate
nnz = nnz*12 ! SLM edit for PETSc to not throw malloc warnings
call MatCreateSeqAIJ(PETSC_COMM_SELF, nrow, nrow, 0, nnz, wall%lhs, ierr)

! Assemble the matrix
Expand Down
22 changes: 0 additions & 22 deletions examples/Makefile.lapack

This file was deleted.

Loading
Loading