Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop_anari
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolemarsaglia committed Oct 14, 2024
2 parents 5d3b6dd + c6d5e2e commit e04699d
Show file tree
Hide file tree
Showing 26 changed files with 2,741 additions and 192 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
### Added
- Added support for unstructured topologies with mixed elements types (for example, hexs and tets).
- Added support for `pyramid` and `wedge` elements.
- Added `sphere`, `cylinder`, `box`, and `plane` options to the slice filter.
- Added a `topologies` option to the relay extract. This allows you to select which topologies are saved. This option can be used with the existing `fields` option, the result is the union of the selected topologies and fields.
- Added `near_plane` and `far_plane` to the camera details provided in Ascent::info()
- Added `add_mpi_ranks` and `add_domain_ids` filters for adding rank and domain fields to a mesh
Expand Down
39 changes: 36 additions & 3 deletions scripts/build_ascent/build_ascent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enable_fortran="${enable_fortran:=OFF}"
enable_python="${enable_python:=OFF}"
enable_openmp="${enable_openmp:=OFF}"
enable_mpi="${enable_mpi:=OFF}"
enable_mpicc="${enable_mpicc:=OFF}"
enable_find_mpi="${enable_find_mpi:=ON}"
enable_tests="${enable_tests:=OFF}"
enable_verbose="${enable_verbose:=ON}"
Expand Down Expand Up @@ -178,6 +179,12 @@ if [ ! -z ${FTN+x} ]; then
cmake_compiler_settings="${cmake_compiler_settings} -DCMAKE_Fortran_COMPILER:PATH=${FTN}"
fi

############################
# mpi related vars
############################
mpicc_exe="${mpicc_exe:=mpicc}"
mpicxx_exe="${mpicxx_exe:=mpic++}"

################
# print all build_ZZZ and enable_ZZZ options
################
Expand Down Expand Up @@ -394,10 +401,21 @@ if [[ "$build_windows" == "ON" ]]; then
caliper_extra_cmake_args="${caliper_windows_cmake_flags}"
fi

# TODO enable_cuda

if [[ "$enable_hip" == "ON" ]]; then
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DWITH_ROCTRACER=ON -DWITH_ROCTX=ON -DROCM_PREFIX=${ROCM_PATH}"
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DWITH_ROCTRACER=ON"
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DWITH_ROCTX=ON"
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DROCM_PREFIX:PATH=${ROCM_PATH}"
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DROCM_ROOT_DIR:PATH=${ROCM_PATH}"
fi

if [[ "$enable_mpicc" == "ON" ]]; then
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DMPI_C_COMPILER=${mpicc_exe}"
caliper_extra_cmake_args="${caliper_extra_cmake_args} -DMPI_CXX_COMPILER=${mpicxx_exe}"
fi


echo "**** Configuring Caliper ${caliper_version}"
cmake -S ${caliper_src_dir} -B ${caliper_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
Expand Down Expand Up @@ -462,6 +480,11 @@ if ${build_silo}; then
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DSILO_DIR=${silo_install_dir}"
fi

if [[ "$enable_mpicc" == "ON" ]]; then
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DMPI_C_COMPILER=${mpicc_exe}"
conduit_extra_cmake_opts="${conduit_extra_cmake_opts} -DMPI_CXX_COMPILER=${mpicxx_exe}"
fi

echo "**** Configuring Conduit ${conduit_version}"
cmake -S ${conduit_src_dir}/src -B ${conduit_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose} \
Expand Down Expand Up @@ -563,18 +586,23 @@ fi

vtkm_extra_cmake_args=""
if [[ "$enable_cuda" == "ON" ]]; then
vtkm_extra_cmake_args="-DVTKm_ENABLE_CUDA=ON"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DVTKm_ENABLE_CUDA=ON"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DCMAKE_CUDA_HOST_COMPILER=${CXX}"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DCMAKE_CUDA_ARCHITECTURES=${CUDA_ARCH}"
fi

if [[ "$enable_hip" == "ON" ]]; then
vtkm_extra_cmake_args="-DVTKm_ENABLE_KOKKOS=ON"
vtkm_extra_cmake_args="${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="${vtkm_extra_cmake_args} -DCMAKE_HIP_ARCHITECTURES=${ROCM_ARCH}"
vtkm_extra_cmake_args="${vtkm_extra_cmake_args} -DVTKm_ENABLE_KOKKOS_THRUST=OFF"
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}"
fi

echo "**** Configuring VTK-m ${vtkm_version}"
cmake -S ${vtkm_src_dir} -B ${vtkm_build_dir} ${cmake_compiler_settings} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${enable_verbose}\
Expand Down Expand Up @@ -903,6 +931,11 @@ if [ ! -z ${FFLAGS+x} ]; then
echo 'set(CMAKE_F_FLAGS "' ${FFLAGS} '" CACHE PATH "")' >> ${root_dir}/ascent-config.cmake
fi

if [[ "$enable_mpicc" == "ON" ]]; then
echo 'set(MPI_C_COMPILER ' ${mpicc_exe} ' CACHE PATH "")' >> ${root_dir}/ascent-config.cmake
echo 'set(MPI_CXX_COMPILER ' ${mpicxx_exe} ' CACHE PATH "")' >> ${root_dir}/ascent-config.cmake
fi

echo 'set(CMAKE_VERBOSE_MAKEFILE ' ${enable_verbose} ' CACHE BOOL "")' >> ${root_dir}/ascent-config.cmake
echo 'set(CMAKE_BUILD_TYPE ' ${build_config} ' CACHE STRING "")' >> ${root_dir}/ascent-config.cmake
echo 'set(BUILD_SHARED_LIBS ' ${build_shared_libs} ' CACHE STRING "")' >> ${root_dir}/ascent-config.cmake
Expand Down
18 changes: 10 additions & 8 deletions scripts/build_ascent/build_ascent_hip_frontier.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
module load cmake #3.23.2
module load PrgEnv-cray
module load craype-accel-amd-gfx90a
module load rocm/5.2.0 #wait for 5.5
module load cray-mpich/8.1.23
module load cce/15.0.1
module load rocm/5.7.1
module load cray-mpich/8.1.28
module load cce/17.0.0
module load cray-python/3.11.5


export MPICH_GPU_SUPPORT_ENABLED=1
export ROCM_ARCH=gfx90a
export CC=$(which cc)
export CXX=$(which CC)
export FTN=$(which ftn)
export CFLAGS="-I${ROCM_PATH}/include"
export CXXFLAGS="-I${ROCM_PATH}/include -Wno-pass-failed"
export LDFLAGS="-L${ROCM_PATH}/lib -lamdhip64"
export HIPFLAGS="-I/opt/cray/pe/mpich/default/ofi/rocm-compiler/5.0/include/"
env enable_mpi=ON enable_find_mpi=OFF ./build_ascent_hip.sh
export CFLAGS="${CRAY_ROCM_INCLUDE_OPTS} -I/opt/cray/pe/mpich/8.1.28/ofi/crayclang/17.0/include/"
export CXXFLAGS="${CRAY_ROCM_INCLUDE_OPTS} -I/opt/cray/pe/mpich/8.1.28/ofi/crayclang/17.0/include/ -Wno-pass-failed"
export LDFLAGS="${CRAY_ROCM_POST_LINK_OPTS}"
#export HIPFLAGS="-I/opt/cray/pe/mpich/default/ofi/rocm-compiler/5.0/include/"
env enable_mpi=ON enable_find_mpi=OFF build_pyvenv=true ENABLE_PYTHON=ON ./build_ascent_hip.sh


1 change: 0 additions & 1 deletion src/cmake/thirdparty/SetupCaliper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ find_package(caliper REQUIRED


set(CALIPER_FOUND TRUE)
set(CONDUIT_USE_CALIPER TRUE)
1 change: 1 addition & 0 deletions src/libs/ascent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ set(ASCENT_PYTHON_ENABLED ${PYTHON_FOUND})
set(ASCENT_PYTHON_EXECUTABLE ${PYTHON_FOUND})

set(ASCENT_LOGGING_ENABLED ${ENABLE_LOGGING})
set(ASCENT_CALIPER_ENABLED ${CALIPER_FOUND})

set(ASCENT_SOURCE_WEB_CLIENT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/web_clients)

Expand Down
2 changes: 1 addition & 1 deletion src/libs/ascent/ascent_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#cmakedefine ASCENT_PYTHON_EXECUTABLE "@PYTHON_EXECUTABLE@"

#cmakedefine ASCENT_LOGGING_ENABLED "@ENABLE_LOGGING@"
#cmakedefine ASCENT_CALIPER_ENABLED "@ASCENT_CALIPER_ENABLED@"
#cmakedefine ASCENT_CALIPER_ENABLED "@CALIPER_FOUND@"

// this path points to the web client js code tree
#cmakedefine ASCENT_SOURCE_WEB_CLIENT_ROOT "@ASCENT_SOURCE_WEB_CLIENT_ROOT@"
Expand Down
167 changes: 114 additions & 53 deletions src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleExtractComponent.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/Invoker.h>
#include <vtkh/DataSet.hpp>

// other ascent includes
Expand Down Expand Up @@ -1891,68 +1893,97 @@ VTKHDataAdapter::AddField(const std::string &field_name,
// Array: valueType=x storageType=N4vtkm4cont15StorageTagBasicE 27 values occupying 216 bytes [0 1 2 ... 24 25 26]
// TypeList: N4vtkm4ListIJfdEEE
// ***********************************************************************
// ***********************************************************************
// NOTE: int32 should work as of sept 10 2024
// ***********************************************************************
//
// else if(n_vals.dtype().is_int32())
// {
// // check that the byte stride is a multiple of native stride
// index_t stride = n_vals.dtype().stride();
// index_t element_stride = stride / sizeof(int32);
// //std::cout << "field name: " << field_name << " <int32>"
// // << " byte stride: " << stride
// // << " element_stride: " << element_stride << std::endl;
// // if element_stride is evenly divided by native, we are good to
// // use vtk m array handles
// if( stride % sizeof(int32) == 0 )
// {
// // in this case we can use a strided array handle
// dset->AddField(detail::GetField<int32>(n_vals,
// field_name,
// assoc_str,
// topo_name,
// element_stride,
// zero_copy));
// supported_type = true;
// }
// }
// else if(n_vals.dtype().is_int64())
// {
// // check that the byte stride is a multiple of native stride
// index_t stride = n_vals.dtype().stride();
// index_t element_stride = stride / sizeof(int64);
// //std::cout << "field name: " << field_name << " <int64>"
// // << " byte stride: " << stride
// // << " element_stride: " << element_stride << std::endl;
// // if element_stride is evenly divided by native, we are good to
// // use vtk m array handles
// if( stride % sizeof(int64) == 0 )
// {
// // in this case we can use a strided array handle
// dset->AddField(detail::GetField<int64>(n_vals,
// field_name,
// assoc_str,
// topo_name,
// element_stride,
// zero_copy));
// supported_type = true;
// }
// }
//else if(n_vals.dtype().is_int32())
//{
// // check that the byte stride is a multiple of native stride
// index_t stride = n_vals.dtype().stride();
// index_t element_stride = stride / sizeof(int32);
// //std::cout << "field name: " << field_name << " <int32>"
// // << " byte stride: " << stride
// // << " element_stride: " << element_stride << std::endl;
// // if element_stride is evenly divided by native, we are good to
// // use vtk m array handles
// if( stride % sizeof(int32) == 0 )
// {
// // in this case we can use a strided array handle
// dset->AddField(detail::GetField<int32>(n_vals,
// field_name,
// assoc_str,
// topo_name,
// element_stride,
// zero_copy));
// supported_type = true;
// }
//}
//else if(n_vals.dtype().is_int64())
//{
// // check that the byte stride is a multiple of native stride
// index_t stride = n_vals.dtype().stride();
// index_t element_stride = stride / sizeof(int64);
// //std::cout << "field name: " << field_name << " <int64>"
// // << " byte stride: " << stride
// // << " element_stride: " << element_stride << std::endl;
// // if element_stride is evenly divided by native, we are good to
// // use vtk m array handles
// if( stride % sizeof(int64) == 0 )
// {
// // in this case we can use a strided array handle
// dset->AddField(detail::GetField<int64>(n_vals,
// field_name,
// assoc_str,
// topo_name,
// element_stride,
// zero_copy));
// supported_type = true;
// }
//}
//else if(n_vals.dtype().is_uint64())
//{
// // check that the byte stride is a multiple of native stride
// index_t stride = n_vals.dtype().stride();
// index_t element_stride = stride / sizeof(uint64);
// //std::cout << "field name: " << field_name << " <int64>"
// // << " byte stride: " << stride
// // << " element_stride: " << element_stride << std::endl;
// // if element_stride is evenly divided by native, we are good to
// // use vtk m array handles
// if( stride % sizeof(uint64) == 0 )
// {
// // in this case we can use a strided array handle
// dset->AddField(detail::GetField<uint64>(n_vals,
// field_name,
// assoc_str,
// topo_name,
// element_stride,
// zero_copy));
// supported_type = true;
// }
//}

// vtk-m cant support zero copy for this layout or was not compiled to expose this datatype
// use float64 by default
if(!supported_type)
{
// std::cout << "WE ARE IN UNSUPPORTED DATA TYPE: "
// << n_vals.dtype().name() << std::endl;

// convert to float64, we use this as a comprise to cover the widest range
// std::cout << "WE ARE IN UNSUPPORTED DATA TYPE: "
// << n_vals.dtype().name() << std::endl;
if(n_vals.dtype().is_uint64())
{

vtkm::cont::ArrayHandle<vtkm::Float64> vtkm_arr;
vtkm_arr.Allocate(num_vals);

// TODO -- FUTURE: Do this conversion w/ device if on device
void *ptr = (void*) vtkh::GetVTKMPointer(vtkm_arr);
Node n_tmp;
n_tmp.set_external(DataType::float64(num_vals),ptr);
n_vals.to_float64_array(n_tmp);
const unsigned long long *input = n_vals.value();
vtkm::cont::ArrayHandle<unsigned long long> input_arr = vtkm::cont::make_ArrayHandle(input, num_vals, vtkm::CopyFlag::Off);

vtkm::cont::Invoker invoker;
vtkh::VTKmTypeCast worklet;

invoker(worklet,input_arr,vtkm_arr);

// add field to dataset
if(assoc_str == "vertex")
Expand All @@ -1967,12 +1998,42 @@ VTKHDataAdapter::AddField(const std::string &field_name,
vtkm::cont::Field::Association::Cells,
vtkm_arr));
}
}
}
else
{
// st d::cout << "WE ARE IN UNSUPPORTED DATA TYPE: "
// << n_vals.dtype().name() << std::endl;

// convert to float64, we use this as a comprise to cover the widest range
vtkm::cont::ArrayHandle<vtkm::Float64> vtkm_arr;
vtkm_arr.Allocate(num_vals);

// TODO -- FUTURE: Do this conversion w/ device if on device
void *ptr = (void*) vtkh::GetVTKMPointer(vtkm_arr);
Node n_tmp;
n_tmp.set_external(DataType::float64(num_vals),ptr);
n_vals.to_float64_array(n_tmp);

// add field to dataset
if(assoc_str == "vertex")
{
dset->AddField(vtkm::cont::Field(field_name.c_str(),
vtkm::cont::Field::Association::Points,
vtkm_arr));
}
else if( assoc_str == "element")
{
dset->AddField(vtkm::cont::Field(field_name.c_str(),
vtkm::cont::Field::Association::Cells,
vtkm_arr));
}
}
// else
// {
// std::cout << "SUPPORTED DATA TYPE: "
// << n_vals.dtype().name() << std::endl;
// }
}
}
catch (vtkm::cont::Error error)
{
Expand Down
Loading

0 comments on commit e04699d

Please sign in to comment.