This commit is contained in:
Dave Pugmire 2022-07-28 07:17:50 -04:00
commit 3a2e17e1ca
9 changed files with 193 additions and 33 deletions

@ -106,7 +106,7 @@
- .docker_image
.ubuntu2004_hip_kokkos: &ubuntu2004_hip_kokkos
image: "kitware/vtkm:ci-ubuntu2004_hip_kokkos-20210827"
image: "kitware/vtkm:ci-ubuntu2004_hip_kokkos-20220620"
extends:
- .docker_image

@ -144,6 +144,9 @@ foreach(option IN LISTS options)
if(VTKm_ENABLE_CUDA)
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_COMMAND}" CACHE STRING "")
endif()
if(VTKm_ENABLE_KOKKOS_HIP)
set(CMAKE_HIP_COMPILER_LAUNCHER "${CCACHE_COMMAND}" CACHE STRING "")
endif()
else()
message(FATAL_ERROR "CCACHE version [${CCACHE_VERSION}] is <= 4")
endif()
@ -165,10 +168,6 @@ if(SCCACHE_COMMAND)
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_COMMAND}" CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_COMMAND}" CACHE STRING "")
if(DEFINED VTKm_ENABLE_KOKKOS_HIP)
set(CMAKE_HIP_COMPILER_LAUNCHER "${SCCACHE_COMMAND}" CACHE STRING "")
endif()
# Use VTKm_CUDA_Architecture to determine if we need CUDA sccache setup
# since this will also capture when kokkos is being used with CUDA backing
if(DEFINED VTKm_CUDA_Architecture OR DEFINED CMAKE_CUDA_ARCHITECTURES)

@ -2,24 +2,35 @@ FROM rocm/dev-ubuntu-20.04
LABEL maintainer "Vicente Adolfo Bolea Sanchez<vicente.bolea@kitware.com>"
# Base dependencies for building VTK-m projects
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
cmake \
curl \
g++ \
git \
git-lfs \
libmpich-dev \
libomp-dev \
mpich \
ninja-build \
rsync \
ssh \
software-properties-common
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
curl \
g++ \
git \
git-lfs \
libmpich-dev \
libomp-dev \
mpich \
ninja-build \
rsync \
ssh \
&& \
apt clean
# Need to run git-lfs install manually on ubuntu based images when using the
# system packaged version
RUN git-lfs install
# Provide CCACHE
ENV CCACHE_DIR "/ccache"
ENV PATH "/opt/ccache/bin:${PATH}"
ARG CCACHE_VERSION=4.6.1
RUN mkdir /opt/ccache/ && \
curl -L https://github.com/ccache/ccache/releases/download/v$CCACHE_VERSION/ccache-$CCACHE_VERSION-linux-x86_64.tar.xz | tar -vxJ && \
make -C ccache-$CCACHE_VERSION-linux-x86_64 install prefix=/opt/ccache && \
rm -rf ccache-$CCACHE_VERSION-linux-x86_64 && \
ccache -z && ccache -s
# Provide CMake
ARG CMAKE_VERSION=3.21.1
RUN mkdir /opt/cmake/ && \
@ -33,11 +44,10 @@ ENV CMAKE_PREFIX_PATH "/opt/rocm/lib/cmake:/opt/rocm/lib:${CMAKE_PREFIX_PATH}"
ENV CMAKE_GENERATOR "Ninja"
# Build and install Kokkos
ARG KOKKOS_VERSION=3.4.01
ARG KOKKOS_VERSION=3.6.00
COPY kokkos_cmake_config.cmake kokkos_cmake_config.cmake
RUN curl -L https://github.com/kokkos/kokkos/archive/refs/tags/$KOKKOS_VERSION.tar.gz | tar -xzf - && \
cmake -S kokkos-$KOKKOS_VERSION -B build -C kokkos_cmake_config.cmake && \
cmake --build build -v && \
sudo cmake --install build
RUN rm -rf build
cmake -S kokkos-$KOKKOS_VERSION -B build -C kokkos_cmake_config.cmake && \
cmake --build build -v && \
cmake --install build && \
rm -rf build kokkos-$KOKKOS_VERSION

@ -72,10 +72,20 @@ build:ubuntu2004_hip_kokkos:
- .run_scheduled
variables:
CMAKE_BUILD_TYPE: RelWithDebInfo
VTKM_SETTINGS: "benchmarks+kokkos+hip+no_virtual+no_rendering"
VTKM_SETTINGS: "benchmarks+kokkos+hip+no_virtual+no_rendering+ccache"
CMAKE_PREFIX_PATH: "/opt/rocm/lib/cmake"
CTEST_MAX_PARALLELISM: "1"
timeout: 12 hours
CCACHE_BASEDIR: "$CI_PROJECT_DIR"
# -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it
CCACHE_IGNOREOPTIONS: "-isystem=*"
CCACHE_COMPILERCHECK: "content"
CCACHE_NOHASHDIR: "true"
CCACHE_RESHARE: "true"
after_script:
- ccache -v -s
- ccache -z
timeout: 10 hours
test:ubuntu2004_hip_kokkos:
tags:

@ -144,8 +144,7 @@ function(vtkm_unit_tests)
if(VTKm_ENABLE_KOKKOS AND (enable_all_backends OR NOT per_device_suffix))
list(APPEND per_device_command_line_arguments --vtkm-device=kokkos)
list(APPEND per_device_suffix "KOKKOS")
#may require more time because of kernel generation.
list(APPEND per_device_timeout 1500)
list(APPEND per_device_timeout 600)
list(APPEND per_device_serial FALSE)
endif()
if(VTKm_ENABLE_TBB AND (enable_all_backends OR NOT per_device_suffix))

@ -11,7 +11,7 @@
#define vtk_m_filter_Probe_h
#include <vtkm/Deprecated.h>
#include <vtkm/filter/resampling //Probe.h>
#include <vtkm/filter/resampling/Probe.h>
namespace vtkm
{

@ -14,6 +14,7 @@ set(unit_tests
set(unit_tests_device
UnitTestCellSetConnectivityFilter.cxx # uses vtkm::cont::Algorithm
UnitTestGraphConnectivityWorklet.cxx
)
set(libraries

@ -0,0 +1,141 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/connected_components/worklet/GraphConnectivity.h>
class AdjacentDifference : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature = void(FieldIn index, WholeArrayIn counts, FieldOut outputCount);
using ExecutionSignature = void(_1, _2, _3);
using InputDomain = _1;
template <typename WholeArrayType>
VTKM_EXEC void operator()(const vtkm::Id& index,
const WholeArrayType& counts,
int& difference) const
{
difference = counts.Get(index + 1) - counts.Get(index);
}
};
class SameComponent : public vtkm::worklet::WorkletMapField
{
public:
using ControlSignature = void(FieldIn start,
FieldIn degree,
WholeArrayIn conns,
WholeArrayIn comps,
AtomicArrayInOut same);
using ExecutionSignature = void(WorkIndex, _1, _2, _3, _4, _5);
template <typename Conn, typename Comp, typename AtomicSame>
VTKM_EXEC void operator()(vtkm::Id index,
int start,
int degree,
const Conn& conns,
const Comp& comps,
AtomicSame& same) const
{
for (vtkm::Id offset = start; offset < start + degree; ++offset)
{
vtkm::Id neighbor = conns.Get(offset);
if (comps.Get(index) != comps.Get(neighbor))
{
same.Set(0, 0);
}
}
}
};
class TestGraphConnectivity
{
public:
void TestECL_CC(const std::string& filename, int ncomps) const
{
auto pathname =
vtkm::cont::testing::Testing::GetTestDataBasePath() + "/third_party/ecl_cc/" + filename;
std::ifstream stream(pathname, std::ios_base::in | std::ios_base::binary);
int nnodes;
stream.read(reinterpret_cast<char*>(&nnodes), sizeof(nnodes));
int nedges;
stream.read(reinterpret_cast<char*>(&nedges), sizeof(nedges));
// CSR, there is one more element in offsets than the actual number of nodes.
std::vector<int> offsets(nnodes + 1);
std::vector<int> conns(nedges);
stream.read(reinterpret_cast<char*>(offsets.data()), (nnodes + 1) * sizeof(int));
stream.read(reinterpret_cast<char*>(conns.data()), nedges * sizeof(int));
vtkm::cont::ArrayHandle<int> counts_h;
vtkm::cont::Invoker invoke;
invoke(AdjacentDifference{},
vtkm::cont::make_ArrayHandleCounting(0, 1, nnodes),
vtkm::cont::make_ArrayHandle<int>(offsets, vtkm::CopyFlag::On),
counts_h);
offsets.pop_back();
vtkm::cont::ArrayHandle<int> offsets_h =
vtkm::cont::make_ArrayHandle(offsets, vtkm::CopyFlag::On);
vtkm::cont::ArrayHandle<int> conns_h = vtkm::cont::make_ArrayHandle(conns, vtkm::CopyFlag::Off);
vtkm::cont::ArrayHandle<vtkm::Id> comps_h;
vtkm::worklet::connectivity::GraphConnectivity().Run(counts_h, offsets_h, conns_h, comps_h);
VTKM_TEST_ASSERT(vtkm::cont::Algorithm::Reduce(comps_h, vtkm::Id(0), vtkm::Maximum{}) ==
ncomps - 1,
"number of components mismatch");
vtkm::cont::ArrayHandle<vtkm::UInt32> atomicSame;
atomicSame.Allocate(1);
atomicSame.WritePortal().Set(0, 1);
invoke(SameComponent{}, offsets_h, counts_h, conns_h, comps_h, atomicSame);
VTKM_TEST_ASSERT(atomicSame.ReadPortal().Get(0) == 1,
"Neighboring nodes don't have the same component id");
}
void TestECL_CC_DataSets() const { TestECL_CC("internet.egr", 1); }
void TestSimpleGraph() const
{
vtkm::cont::ArrayHandle<vtkm::Id> counts_h =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ 1, 1, 2, 2, 2 });
vtkm::cont::ArrayHandle<vtkm::Id> offsets_h =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ 0, 1, 2, 4, 6 });
vtkm::cont::ArrayHandle<vtkm::Id> conn_h =
vtkm::cont::make_ArrayHandle<vtkm::Id>({ 2, 4, 0, 3, 2, 4, 1, 3 });
vtkm::cont::ArrayHandle<vtkm::Id> comps;
vtkm::worklet::connectivity::GraphConnectivity().Run(counts_h, offsets_h, conn_h, comps);
for (int i = 0; i < comps.GetNumberOfValues(); i++)
{
VTKM_TEST_ASSERT(comps.ReadPortal().Get(i) == 0, "Components has unexpected value.");
}
}
void operator()() const
{
TestSimpleGraph();
TestECL_CC_DataSets();
}
};
int UnitTestGraphConnectivityWorklet(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestGraphConnectivity{}, argc, argv);
}

@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_filter_Probe_h
#define vtk_m_filter_Probe_h
#ifndef vtk_m_filter_resampling_Probe_h
#define vtk_m_filter_resampling_Probe_h
#include <vtkm/filter/NewFilterField.h>
#include <vtkm/filter/resampling/vtkm_filter_resampling_export.h>
@ -62,4 +62,4 @@ class VTKM_DEPRECATED(1.8, "Use vtkm::filter::resampling::Probe.") Probe
} // namespace filter
} // namespace vtkm
#endif // vtk_m_filter_Probe_h
#endif // vtk_m_filter_resampling_Probe_h