forked from lanl/ELEMENTS
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lanl#25 from lanl/Daniel
Looks good
- Loading branch information
Showing
25 changed files
with
997 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/ElementsTargets.cmake") | ||
check_required_components("@Elements@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
add_library(input input.cpp) | ||
|
||
target_link_libraries(input Elements) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule matar
updated
74 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
all scripts can be built fully by entering the appropriate directory and doing | ||
source build-it.sh <arg1 arg2 ...> | ||
build-it.sh can take up to 3 arguments (minimum of 2) | ||
source build-it.sh <environment type> <parallelism> <build directory name (optional)> | ||
environment has two options: 'hpc' or 'macos' | ||
hpc: builds by loading modules and can perform parallel builds (make -j) | ||
macos: does not load anything externally and expects the environment to be set up on your mac. Additionally, the builds will all be serial (make) | ||
parallelism has four options: 'cuda', 'hip', 'openmp', 'none' | ||
Note - all builds use Kokkos. The 'none' option will still use Kokkos, however only utilizing the Kokkos Serial build | ||
cuda: loads cuda module and a working gcc module pairing (these can be changed, more info later) | ||
hip: loads hip module and a working clang module pairing | ||
openmp: loads gcc module and sets openmp environment variables | ||
none: loads gcc module | ||
build directory is an optional argument which will create the name of the build directory | ||
|
||
All other scripts will be called with the appropriate arguments as a result of running build-it. | ||
|
||
If you need to simply rebuild the app and not get a new kokkos installation, simply | ||
source cmake_build.sh <args> | ||
with the same arguments you would with build-it.sh | ||
|
||
If you log onto a machine for the first time (or get a new allocation) you will need to run | ||
source setup-env.sh <args> | ||
with the same arguments you would with build-it.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
#!/bin/bash -e | ||
show_help() { | ||
echo "Usage: source $(basename "$BASH_SOURCE") [OPTION]" | ||
echo "Valid options:" | ||
echo " --execution=<examples|test>. Default is 'all'" | ||
echo " --kokkos_build_type=<none|serial|openmp|pthreads|cuda|hip>. Default is 'serial'" | ||
echo " --build_action=<full-app|set-env|install-kokkos|install-elements|elements>. Default is 'full-app'" | ||
echo " --machine=<darwin|chicoma|linux|mac>. Default is 'linux'" | ||
echo " --build_cores=<Integers greater than 0>. Default is set 1" | ||
echo " --help: Display this help message" | ||
echo " " | ||
echo " " | ||
echo " " | ||
echo " --build_action The desired build step to be execute. The default action is 'full-app'" | ||
echo " " | ||
echo " full-app builds Fierro from scratch, installing dependencies where necessary." | ||
echo " set-env set appropriate environment variables and loads software modules (if necessary)" | ||
echo " install-kokkos builds and installs Kokkos if not already installed. Clones from github if necessary" | ||
echo " install-elements builds and installs Elements if not already installed." | ||
echo " elements Generates CMake files and builds Elements only (none of the dependencies)." | ||
echo " " | ||
echo " --execution Builds the desired executables you want to run. The default action is 'all'" | ||
echo " " | ||
echo " examples builds examples" | ||
echo " test builds tests" | ||
echo " " | ||
echo " --kokkos_build_type The desired kokkos parallel backend to use. The default is 'serial'" | ||
echo " " | ||
echo " none No Kokkos backend" | ||
echo " serial Serial Kokkos backend" | ||
echo " openmp OpenMP Kokkos backend" | ||
echo " pthreads pthreads Kokkos backend" | ||
echo " cuda Cuda Kokkos backend" | ||
echo " hip HIP Kokkos backend" | ||
echo " " | ||
echo " --machine The machine you are building for. The default is 'linux'" | ||
echo " " | ||
echo " darwin The darwin cluster at LANL. Uses module loads for software" | ||
echo " linux A general linux machine (that does not use modules)" | ||
echo " mac A Mac computer. This option does not allow for cuda and hip builds, and build_cores will be set to 1" | ||
echo " " | ||
echo " --build_cores The number of build cores to be used by make and make install commands. The default is 1" | ||
return 1 | ||
} | ||
|
||
# Initialize variables with default values | ||
build_action="full-app" | ||
execution="examples" | ||
machine="linux" | ||
kokkos_build_type="serial" | ||
build_cores="1" | ||
|
||
# Define arrays of valid options | ||
valid_build_action=("full-app" "set-env" "install-matar" "install-elements" "install-kokkos" "elements") | ||
valid_execution=("examples" "test") | ||
valid_kokkos_build_types=("none" "serial" "openmp" "pthreads" "cuda" "hip") | ||
valid_machines=("darwin" "chicoma" "linux" "mac") | ||
|
||
# Parse command line arguments | ||
for arg in "$@"; do | ||
case "$arg" in | ||
--build_action=*) | ||
option="${arg#*=}" | ||
if [[ " ${valid_build_action[*]} " == *" $option "* ]]; then | ||
build_action="$option" | ||
else | ||
echo "Error: Invalid --build_action specified." | ||
show_help | ||
return 1 | ||
fi | ||
;; | ||
--execution=*) | ||
option="${arg#*=}" | ||
if [[ " ${valid_execution[*]} " == *" $option "* ]]; then | ||
execution="$option" | ||
else | ||
echo "Error: Invalid --execution specified." | ||
show_help | ||
return 1 | ||
fi | ||
;; | ||
--machine=*) | ||
option="${arg#*=}" | ||
if [[ " ${valid_machines[*]} " == *" $option "* ]]; then | ||
machine="$option" | ||
else | ||
echo "Error: Invalid --machine specified." | ||
show_help | ||
return 1 | ||
fi | ||
;; | ||
--kokkos_build_type=*) | ||
option="${arg#*=}" | ||
if [[ " ${valid_kokkos_build_types[*]} " == *" $option "* ]]; then | ||
kokkos_build_type="$option" | ||
else | ||
echo "Error: Invalid --kokkos_build_type specified." | ||
show_help | ||
return 1 | ||
fi | ||
;; | ||
--build_cores=*) | ||
option="${arg#*=}" | ||
if [ $option -ge 1 ]; then | ||
build_cores="$option" | ||
else | ||
echo "Error: Invalid --build_cores specified." | ||
show_help | ||
return 1 | ||
fi | ||
;; | ||
--help) | ||
show_help | ||
return 1 | ||
;; | ||
*) | ||
echo "Error: Invalid argument or value specified." | ||
show_help | ||
return 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Check for correct combos with mac | ||
if [ "$machine" = "mac" ] && [ "$kokkos_build_type" = "cuda" ]; then | ||
echo "Error: Mac cannot build with Kokkos Cuda backend" | ||
show_help | ||
return 1 | ||
fi | ||
|
||
if [ "$machine" = "mac" ] && [ "$kokkos_build_type" = "hip" ]; then | ||
echo "Error: Mac cannot build with Kokkos HIP backend" | ||
show_help | ||
return 1 | ||
fi | ||
|
||
if [ "$machine" = "mac" ] && [ $build_cores -ne 1 ]; then | ||
echo "Error: Mac cannot be built in parallel. Setting build cores to default 1" | ||
# Nothing to do, default is already 1 | ||
fi | ||
|
||
|
||
echo "Building based on these argument options:" | ||
echo "Build action - ${build_action}" | ||
echo "Execution - ${execution}" | ||
echo "Kokkos backend - ${kokkos_build_type}" | ||
echo "make -j ${build_cores}" | ||
|
||
cd "$( dirname "${BASH_SOURCE[0]}" )" | ||
|
||
# Always setup the environment | ||
source setup-env.sh ${machine} ${kokkos_build_type} ${build_cores} | ||
|
||
# Next, do action based on args | ||
if [ "$build_action" = "full-app" ]; then | ||
source kokkos-install.sh ${kokkos_build_type} | ||
source elements-install.sh ${kokkos_build_type} | ||
source cmake_build_${execution}.sh ${kokkos_build_type} | ||
elif [ "$build_action" = "install-kokkos" ]; then | ||
source kokkos-install.sh ${kokkos_build_type} | ||
elif [ "$build_action" = "install-elements" ]; then | ||
source elements-install.sh ${kokkos_build_type} | ||
elif [ "$build_action" = "elements" ]; then | ||
source cmake_build_${execution}.sh ${kokkos_build_type} | ||
else | ||
echo "No build action, only setup the environment." | ||
fi | ||
|
||
cd ${basedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash -e | ||
|
||
kokkos_build_type="${1}" | ||
|
||
if [ ! -d "${EXAMPLE_SOURCE_DIR}/phaseFieldMPI/heffte" ] | ||
then | ||
echo "Missing heffte for examples, downloading...." | ||
git clone https://bitbucket.org/icl/heffte.git ${EXAMPLE_SOURCE_DIR}/phaseFieldMPI/heffte | ||
fi | ||
|
||
cmake_options=( | ||
-D CMAKE_PREFIX_PATH="${ELEMENTS_INSTALL_DIR};${KOKKOS_INSTALL_DIR}" | ||
) | ||
|
||
if [ "$kokkos_build_type" = "none" ]; then | ||
cmake_options+=( | ||
-D Matar_ENABLE_KOKKOS=OFF | ||
) | ||
else | ||
cmake_options+=( | ||
-D Matar_ENABLE_KOKKOS=ON | ||
) | ||
fi | ||
|
||
# Print CMake options for reference | ||
echo "CMake Options: ${cmake_options[@]}" | ||
|
||
# Configure Examples | ||
cmake "${cmake_options[@]}" -B "${EXAMPLE_BUILD_DIR}" -S "${EXAMPLE_SOURCE_DIR}" | ||
|
||
# Build Examples | ||
make -C "${EXAMPLE_BUILD_DIR}" -j${ELEMENTS_BUILD_CORES} | ||
|
||
cd $basedir |
Oops, something went wrong.