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

Ascent blueprint topologies fix #1407

Closed
Closed
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
49 changes: 40 additions & 9 deletions scripts/build_ascent/build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set -eu -o pipefail
# shared options
enable_cuda="${enable_cuda:=OFF}"
enable_hip="${enable_hip:=OFF}"
enable_sycl="${enable_sycl:=OFF}"
enable_fortran="${enable_fortran:=OFF}"
enable_python="${enable_python:=OFF}"
enable_openmp="${enable_openmp:=OFF}"
Expand Down Expand Up @@ -81,6 +82,14 @@ if [[ "$enable_hip" == "ON" ]]; then
ROCM_PATH="${ROCM_PATH:=/opt/rocm/}"

# NOTE: this script only builds kokkos when enable_hip=ON
build_kokkos="${build_kokkos:=true}"
elif [[ "$enable_sycl" == "ON" ]]; then
echo "*** configuring with SYCL support"

CC=`which icx`
CXX=`which icpx`
FTN=`which ifx`

build_kokkos="${build_kokkos:=true}"
else
build_kokkos="${build_kokkos:=false}"
Expand Down Expand Up @@ -519,7 +528,7 @@ kokkos_build_dir=$(ospath ${build_dir}/kokkos-${kokkos_version})
kokkos_install_dir=$(ospath ${install_dir}/kokkos-${kokkos_version}/)
kokkos_tarball=$(ospath ${source_dir}/kokkos-${kokkos_version}.tar.gz)

if [[ "$enable_hip" == "ON" ]]; then
if [[ "$enable_hip" == "ON" ]] || [[ "$enable_sycl" == "ON" ]]; then
# build only if install doesn't exist
if [ ! -d ${kokkos_install_dir} ]; then
if ${build_kokkos}; then
Expand All @@ -529,21 +538,33 @@ if [ ! -d ${kokkos_src_dir} ]; then
tar ${tar_extra_args} -xzf ${kokkos_tarball} -C ${source_dir}
fi

kokkos_extra_cmake_args=""
if [[ "$enable_hip" == "ON" ]]; then
kokkos_extra_cmake_args="-DKokkos_ENABLE_HIP=ON"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=OFF"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DKokkos_ARCH_VEGA90A=ON"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DCMAKE_CXX_FLAGS=--amdgpu-target=${ROCM_ARCH}"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DCMAKE_CXX_COMPILER=${ROCM_PATH}/bin/hipcc"
fi

if [[ "$enable_sycl" == "ON" ]]; then
kokkos_extra_cmake_args="-DCMAKE_CXX_FLAGS=-fPIC -fp-model=precise -Wno-unused-command-line-argument -Wno-deprecated-declarations -fsycl-device-code-split=per_kernel -fsycl-max-parallel-link-jobs=128"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DKokkos_ENABLE_SYCL=ON"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DKokkos_ARCH_INTEL_PVC=ON"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DCMAKE_CXX_EXTENSIONS=OFF"
kokkos_extra_cmake_args="${kokkos_extra_cmake_args} -DCMAKE_CXX_STANDARD=17"
fi

# TODO: DKokkos_ARCH_VEGA90A needs to be controlled / mapped?

echo "**** Configuring Kokkos ${kokkos_version}"
cmake -S ${kokkos_src_dir} -B ${kokkos_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose}\
-DCMAKE_BUILD_TYPE=${build_config} \
-DBUILD_SHARED_LIBS=${build_shared_libs} \
-DKokkos_ARCH_VEGA90A=ON \
-DCMAKE_CXX_COMPILER=${ROCM_PATH}/bin/hipcc \
-DKokkos_ENABLE_HIP=ON \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=OFF \
-DCMAKE_INSTALL_PREFIX=${kokkos_install_dir} \
-DCMAKE_CXX_FLAGS="--amdgpu-target=${ROCM_ARCH}" \
-DBUILD_TESTING=OFF \
-DBUILD_TESTING=OFF "${kokkos_extra_cmake_args}" \
-DCMAKE_INSTALL_PREFIX=${kokkos_install_dir}

echo "**** Building Kokkos ${kokkos_version}"
Expand All @@ -556,7 +577,7 @@ else
echo "**** Skipping Kokkos build, install found at: ${kokkos_install_dir}"
fi # build_kokkos

fi # if enable_hip
fi # if enable_hip || enable_sycl

################
# VTK-m
Expand Down Expand Up @@ -598,6 +619,12 @@ if [[ "$enable_hip" == "ON" ]]; then
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DVTKm_ENABLE_KOKKOS_THRUST=OFF"
fi

if [[ "$enable_sycl" == "ON" ]]; then
vtkm_extra_cmake_args="-DVTKm_ENABLE_KOKKOS=ON"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DCMAKE_PREFIX_PATH=${kokkos_install_dir}"
vtkm_extra_cmake_args="-DCMAKE_CXX_FLAGS=-fPIC -fp-model=precise -Wno-unused-command-line-argument -Wno-deprecated-declarations -fsycl-device-code-split=per_kernel -fsycl-max-parallel-link-jobs=128"
fi

if [[ "$enable_mpicc" == "ON" ]]; then
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DMPI_C_COMPILER=${mpicc_exe}"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DMPI_CXX_COMPILER=${mpicxx_exe}"
Expand All @@ -617,7 +644,7 @@ cmake -S ${vtkm_src_dir} -B ${vtkm_build_dir} ${cmake_compiler_settings} \
-DVTKm_ENABLE_RENDERING=ON \
-DVTKm_ENABLE_TESTING=OFF\
-DBUILD_TESTING=OFF \
-DVTKm_ENABLE_BENCHMARKS=OFF ${vtkm_extra_cmake_args} \
-DVTKm_ENABLE_BENCHMARKS=OFF "${vtkm_extra_cmake_args}" \
-DCMAKE_INSTALL_PREFIX=${vtkm_install_dir}

echo "**** Building VTK-m ${vtkm_version}"
Expand Down Expand Up @@ -763,6 +790,10 @@ if [[ "$enable_hip" == "ON" ]]; then
umpire_extra_cmake_args="${umpire_extra_cmake_args} -DROCM_PATH=${ROCM_PATH}"
fi

if [[ "$enable_sycl" == "ON" ]]; then
umpire_extra_cmake_args="${umpire_extra_cmake_args} -DENABLE_SYCL=ON"
fi

# build only if install doesn't exist
if [ ! -d ${umpire_install_dir} ]; then
if ${build_umpire}; then
Expand Down
21 changes: 21 additions & 0 deletions scripts/build_ascent/build_ascent_aurora.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -l

export IGC_FunctionCloningThreshold=1
export IGC_ControlInlineTinySize=100
export IGC_OCLInlineThreshold=200
export IGC_PartitionUnit=1
export IGC_ForceOCLSIMDWidth=16
export ZE_AFFINITY_MASK=0.0

# Proxies
export HTTP_PROXY=http://proxy.alcf.anl.gov:3128
export HTTPS_PROXY=http://proxy.alcf.anl.gov:3128
export http_proxy=http://proxy.alcf.anl.gov:3128
export https_proxy=http://proxy.alcf.anl.gov:3128

module reset
module use /soft/modulefiles
module load spack-pe-gcc cmake
module load oneapi/eng-compiler/2023.12.15.002

env enable_sycl=ON enable_mpi=ON enable_fortran=ON raja_enable_vectorization=OFF enable_tests=ON enable_verbose=ON ./build_ascent_sycl.sh
21 changes: 21 additions & 0 deletions scripts/build_ascent/build_ascent_sycl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

##############################################################################
# Demonstrates how to manually build Ascent and its dependencies, including:
#
# hdf5, conduit, vtk-m, mfem, raja, and umpire
#
# usage example:
# env enable_mpi=ON enable_openmp=ON ./build_ascent.sh
#
#
# Assumes:
# - cmake is in your path
# - selected compilers are in your path or set via env vars
# - [when enabled] MPI and Python (+numpy and mpi4py), are in your path
#
##############################################################################
set -eu -o pipefail

# 2024-02-08 SYCL support is handled by our unified script
env enable_sycl=ON ./build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ PointTopology<T, N>::PointTopology(const std::string &topo_name,
<< " which has type '" << this->topo_type << "'.");
}

if(this->coord_type == "uniform")
if(this->coords_type == "uniform")
{
const conduit::Node &n_coords = domain["coordsets/" + this->coords_name];
const conduit::Node &n_dims = n_coords["dims"];
Expand All @@ -177,7 +177,7 @@ PointTopology<T, N>::PointTopology(const std::string &topo_name,
num_cells *= dims[i] - 1;
}
}
else if(this->coord_type == "rectilinear")
else if(this->coords_type == "rectilinear")
{
const conduit::Node &values =
domain["coordsets/" + this->coords_name + "/values"];
Expand All @@ -189,7 +189,7 @@ PointTopology<T, N>::PointTopology(const std::string &topo_name,
num_points *= coords[i].dtype().number_of_elements();
}
}
else if(this->coord_type == "explicit")
else if(this->coords_type == "explicit")
{
const conduit::Node &values =
domain["coordsets/" + this->coords_name + "/values"];
Expand All @@ -203,7 +203,7 @@ PointTopology<T, N>::PointTopology(const std::string &topo_name,
else
{
ASCENT_ERROR("Unknown coordinate type '"
<< this->coord_type << "' for point topology '" << topo_name
<< this->coords_type << "' for point topology '" << topo_name
<< "' in domain " << domain.name() << ".");
}
}
Expand All @@ -213,15 +213,15 @@ std::array<conduit::float64, 3>
PointTopology<T, N>::vertex_location(const size_t index) const
{
std::array<conduit::float64, 3> loc{};
if(this->coord_type == "uniform")
if(this->coords_type == "uniform")
{
auto l_index = detail::logical_index(index, dims);
for(size_t i = 0; i < N; ++i)
{
loc[i] = origin[i] + l_index[i] * spacing[i];
}
}
else if(this->coord_type == "rectilinear")
else if(this->coords_type == "rectilinear")
{
std::array<size_t, N> dims;
for(size_t i = 0; i < N; ++i)
Expand All @@ -234,7 +234,7 @@ PointTopology<T, N>::vertex_location(const size_t index) const
loc[i] = coords[i][l_index[i]];
}
}
else if(this->coord_type == "explicit")
else if(this->coords_type == "explicit")
{
for(size_t i = 0; i < N; ++i)
{
Expand All @@ -244,7 +244,7 @@ PointTopology<T, N>::vertex_location(const size_t index) const
else
{
ASCENT_ERROR("Unknown coordinate type '"
<< this->coord_type << "' for point topology '" << topo_name
<< this->coords_type << "' for point topology '" << topo_name
<< "' in domain " << domain.name() << ".");
}
return loc;
Expand Down
Loading