Merge remote-tracking branch 'upstream/master' into Enhance-Testing-From-File

This commit is contained in:
James 2020-03-27 11:33:18 -04:00
commit 46d7d1865a
147 changed files with 5266 additions and 2054 deletions

125
.gitlab-ci-ecp.yml Normal file

@ -0,0 +1,125 @@
.slurm_p9_cuda: &slurm_p9_cuda
tags:
- nmc
- slurm
- nmc-xxfe1-sched-001
- xx-fe1
variables:
NMC_FE1_SLURM_PARAMETERS: " -N1 -p ecp-p9-4v100 --extra-node-info=*:*:* -t 1:30:00 "
CC: "gcc"
CXX: "g++"
CUDAHOSTCXX: "g++"
before_script:
# We need gcc-4.8.5, which is the system default compiler but not a compiler
# listed under the module system.
#
# That means to get this to work properly we explicitly do not request
# any compiler.
- module load cuda cmake/3.14.5
.slurm_p9_opemp: &slurm_p9_opemp
tags:
- nmc
- slurm
- nmc-xxfe1-sched-001
- xx-fe1
variables:
NMC_FE1_SLURM_PARAMETERS: " -N1 -p ecp-p9-4v100 --extra-node-info=*:*:* -t 1:30:00 "
before_script:
- module load gcc/8.3.0 openmpi/3.1.4 cmake/3.14.5
.cmake_build_artifacts: &cmake_build_artifacts
artifacts:
expire_in: 24 hours
when: always
paths:
# The artifacts of the build.
- vtkm-build/bin/
- vtkm-build/include/
# CTest files.
# XXX(globbing): Can be simplified with support from
# https://gitlab.com/gitlab-org/gitlab-runner/issues/4840
- vtkm-build/CTestCustom*.cmake
- vtkm-build/CTestTestfile.cmake
- vtkm-build/*/CTestTestfile.cmake
- vtkm-build/*/*/CTestTestfile.cmake
- vtkm-build/*/*/*/CTestTestfile.cmake
- vtkm-build/*/*/*/*/CTestTestfile.cmake
- vtkm-build/*/*/*/*/*/CTestTestfile.cmake
- vtkm-build/Testing/
# CDash files.
- vtkm-build/DartConfiguration.tcl
.cmake_build_p9_cuda: &cmake_build_p9_cuda
stage: build
script:
- srun env | grep SLURM_JOB_NAME
- mkdir vtkm-build
- pushd vtkm-build
- cmake -DCMAKE_BUILD_TYPE=Release -DVTKm_ENABLE_CUDA=ON -S ../
- cmake --build . -j20
- popd
.cmake_build_p9_openmp: &cmake_build_p9_openmp
stage: build
script:
- srun env | grep SLURM_JOB_NAME
- mkdir vtkm-build
- pushd vtkm-build
- cmake -DCMAKE_BUILD_TYPE=Release -DVTKm_ENABLE_OPENMP=ON -S ../
- cmake --build . -j20
- popd
.cmake_test_p9: &cmake_test_p9
stage: test
script:
- echo "running the test using artifacts of the build"
- pushd vtkm-build
# We need to exclude the following tests
# - CopyrightStatement
# - TestInstallSetup
# - SourceInInstall
# Which we can do by using an exclude regex
- ctest -E "Install|CopyrightStatement"
- popd
stages:
- build
- test
build:p9_openmp:
extends:
- .slurm_p9_opemp
- .cmake_build_artifacts
- .cmake_build_p9_openmp
test:p9_openmp:
extends:
- .slurm_p9_opemp
- .cmake_test_p9
dependencies:
- build:p9_openmp
needs:
- build:p9_openmp
build:p9_cuda:
extends:
- .slurm_p9_cuda
- .cmake_build_artifacts
- .cmake_build_p9_cuda
test:p9_cuda:
extends:
- .slurm_p9_cuda
- .cmake_test_p9
dependencies:
- build:p9_cuda
needs:
- build:p9_cuda

143
.gitlab-ci.yml Normal file

@ -0,0 +1,143 @@
# Docker Images:
#
# - CentOS 7
# * .gitlab/ci/docker/centos7/cuda10.2/
# - cuda
# - gcc 4.8.5
# * .gitlab/ci/rhel8/cuda10.2/
# - cuda
# - gcc 8.2.1
# * .gitlab/ci/ubuntu1604/base/
# - gcc 4.8
# - clang 3.8
# - clang 5.0
# - tbb
# - openmpi
# * .gitlab/ci/ubuntu1604/cuda9.2/
# - cuda
# - gcc 5.4
# - tbb
# - openmp
# - openmpi
# * .gitlab/ci/ubuntu1804/base/
# - gcc 7.4
# - gcc 9
# - clang 8
# - tbb
# - openmp
# - mpich2
# * .gitlab/ci/ubuntu1804/cuda10.1/
# - cuda
# - gcc 7.4
# - tbb
# - openmp
# - mpich2
.docker_image: &docker_image
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR/gitlab-kitware-sciviz-ci
.centos7: &centos7
image: "kitware/vtkm:ci-centos7_cuda10.2-20200320"
extends:
- .docker_image
.rhel8: &rhel8
image: "kitware/vtkm:ci-rhel8_cuda10.2-20200320"
extends:
- .docker_image
.ubuntu1604: &ubuntu1604
image: "kitware/vtkm:ci-ubuntu1604-20200320"
extends:
- .docker_image
.ubuntu1604_cuda: &ubuntu1604_cuda
image: "kitware/vtkm:ci-ubuntu1604_cuda9.2-20200320"
extends:
- .docker_image
.ubuntu1804: &ubuntu1804
image: "kitware/vtkm:ci-ubuntu1804-20200320"
extends:
- .docker_image
.ubuntu1804_cuda: &ubuntu1804_cuda
image: "kitware/vtkm:ci-ubuntu1804_cuda10.1-20200320"
extends:
- .docker_image
# General Longer Term Tasks:
# - setup asan, and ubsan as sub-pipeline
# - setup clang tidy as sub-pipeline
#
# Current Tasks:
# - Determine if we can get sccache to work with CUDA
# - Setup a machine to replicate the issue in https://gitlab.kitware.com/vtk/vtk-m/issues/447
# Note: Centos7 doesn't work as they ship separate standard library
# headers for each version. We will have to figure out something else
# like using spack or building llvm/clang from source
stages:
- build
- test
.cmake_build_linux: &cmake_build_linux
stage: build
timeout: 2 hours
interruptible: true
before_script:
- .gitlab/ci/config/sccache.sh
- export PATH=$PWD/.gitlab:$PATH
- SCCACHE_IDLE_TIMEOUT=1200 sccache --start-server
- sccache --show-stats
- "cmake --version"
- "cmake -V -P .gitlab/ci/config/gitlab_ci_setup.cmake"
script:
- "ctest -VV -S .gitlab/ci/ctest_configure.cmake"
- "ctest -VV -S .gitlab/ci/ctest_build.cmake"
- sccache --show-stats
artifacts:
expire_in: 24 hours
when: always
paths:
# The artifacts of the build.
- build/bin/
- build/include/
- build/lib/
# CTest and CMake install files.
# XXX(globbing): Can be simplified with support from
# https://gitlab.com/gitlab-org/gitlab-runner/issues/4840
#
# Note: this also captures our CIState.cmake file
- build/CMakeCache.txt
- build/*.cmake
- build/*/*.cmake
- build/*/*/*.cmake
- build/*/*/*/*.cmake
- build/*/*/*/*/*.cmake
- build/*/*/*/*/*/*.cmake
- build/Testing/
# CDash files.
- build/DartConfiguration.tcl
.cmake_test_linux: &cmake_test_linux
stage: test
timeout: 30 minutes
interruptible: true
script:
#Need to use our custom ctest-latest symlink
#This will allow us to use 3.17+ which has support
#for running failed tests multiple times so failures
#due to system load are not reported
- "ctest-latest -VV -S .gitlab/ci/ctest_test.cmake"
include:
- local: '/.gitlab/ci/centos7.yml'
- local: '/.gitlab/ci/rhel8.yml'
- local: '/.gitlab/ci/ubuntu1604.yml'
- local: '/.gitlab/ci/ubuntu1804.yml'

49
.gitlab/ci/centos7.yml Normal file

@ -0,0 +1,49 @@
# Build on centos7 with CUDA and test on rhel8 and centos7
# gcc 4.8
build:centos7_gcc48:
tags:
- build
- vtkm
- docker
- linux
- large-memory
extends:
- .centos7
- .cmake_build_linux
variables:
CMAKE_BUILD_TYPE: RelWithDebInfo
CMAKE_GENERATOR: "Unix Makefiles"
VTKM_SETTINGS: "cuda+turing+32bit_ids"
test:centos7_gcc48:
tags:
- test
- cuda-rt
- turing
- vtkm
- docker
- linux
extends:
- .centos7
- .cmake_test_linux
dependencies:
- build:centos7_gcc48
needs:
- build:centos7_gcc48
test:rhel8_test_centos7:
tags:
- test
- cuda-rt
- turing
- vtkm
- docker
- linux
extends:
- .rhel8
- .cmake_test_linux
dependencies:
- build:centos7_gcc48
needs:
- build:centos7_gcc48

@ -0,0 +1,82 @@
##=============================================================================
##
## 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.
##
##=============================================================================
if (NOT DEFINED "ENV{GITLAB_CI}")
message(FATAL_ERROR
"This script assumes it is being run inside of GitLab-CI")
endif ()
# Set up the source and build paths.
set(CTEST_SOURCE_DIRECTORY "$ENV{CI_PROJECT_DIR}")
set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build")
if ("$ENV{VTKM_SETTINGS}" STREQUAL "")
message(FATAL_ERROR
"The VTKM_SETTINGS environment variable is required to know what "
"build options should be used.")
endif ()
# Default to Release builds.
if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_BUILD_TYPE}")
endif ()
if (NOT CTEST_BUILD_CONFIGURATION)
set(CTEST_BUILD_CONFIGURATION "Release")
endif ()
# Set the build metadata.
string(TOLOWER ${CTEST_BUILD_CONFIGURATION} build_type)
set(CTEST_BUILD_NAME "${build_type}+$ENV{VTKM_SETTINGS}")
set(site_name "$ENV{CI_JOB_NAME}")
string(REPLACE "build" "" site_name "${site_name}")
string(REPLACE "test" "" site_name "${site_name}")
string(REPLACE ":" "" site_name "${site_name}")
set(CTEST_SITE ${site_name})
# Default to using Ninja.
if (NOT "$ENV{CMAKE_GENERATOR}" STREQUAL "")
set(CTEST_CMAKE_GENERATOR "$ENV{CMAKE_GENERATOR}")
endif ()
if (NOT CTEST_CMAKE_GENERATOR)
set(CTEST_CMAKE_GENERATOR "Ninja")
endif ()
# Determine the track to submit to.
set(CTEST_TRACK "Experimental")
if ("$ENV{CI_COMMIT_REF_NAME}" STREQUAL "master")
set(CTEST_TRACK "Nightly")
endif ()
if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles")
include(ProcessorCount)
ProcessorCount(nproc)
set(CTEST_BUILD_FLAGS "-j${nproc}")
endif ()
#We need to do write this information out to a file in the build directory
set(state
"
set(CTEST_SOURCE_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\")
set(CTEST_BINARY_DIRECTORY \"${CTEST_BINARY_DIRECTORY}\")
set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME})
set(CTEST_SITE ${CTEST_SITE})
set(CTEST_CMAKE_GENERATOR \"${CTEST_CMAKE_GENERATOR}\")
set(CTEST_BUILD_CONFIGURATION ${CTEST_BUILD_CONFIGURATION})
set(CTEST_BUILD_FLAGS \"${CTEST_BUILD_FLAGS}\")
set(CTEST_TRACK ${CTEST_TRACK})
"
)
file(WRITE ${CTEST_BINARY_DIRECTORY}/CIState.cmake "${state}")

@ -0,0 +1,61 @@
##=============================================================================
##
## 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.
##
##=============================================================================
string(REPLACE "+" ";" options "$ENV{VTKM_SETTINGS}")
foreach(option IN LISTS options)
if(static STREQUAL option)
set(BUILD_SHARED_LIBS "OFF" CACHE STRING "")
elseif(shared STREQUAL option)
set(BUILD_SHARED_LIBS "ON" CACHE STRING "")
elseif(32bit_ids STREQUAL option)
set(VTKm_USE_64BIT_IDS "OFF" CACHE STRING "")
elseif(64bit_floats STREQUAL option)
set(VTKm_USE_DOUBLE_PRECISION "ON" CACHE STRING "")
elseif(mpi STREQUAL option)
set(VTKm_ENABLE_MPI "ON" CACHE STRING "")
elseif(tbb STREQUAL option)
set(VTKm_ENABLE_TBB "ON" CACHE STRING "")
elseif(openmp STREQUAL option)
set(VTKm_ENABLE_OPENMP "ON" CACHE STRING "")
elseif(cuda STREQUAL option)
set(VTKm_ENABLE_CUDA "ON" CACHE STRING "")
elseif(maxwell STREQUAL option)
set(VTKm_CUDA_Architecture "maxwell" CACHE STRING "")
elseif(pascal STREQUAL option)
set(VTKm_CUDA_Architecture "pascal" CACHE STRING "")
elseif(volta STREQUAL option)
set(VTKm_CUDA_Architecture "volta" CACHE STRING "")
elseif(turing STREQUAL option)
set(VTKm_CUDA_Architecture "turing" CACHE STRING "")
endif()
endforeach()
set(CTEST_USE_LAUNCHERS "ON" CACHE STRING "")
set(CMAKE_C_COMPILER_LAUNCHER "sccache" CACHE STRING "")
set(CMAKE_CXX_COMPILER_LAUNCHER "sccache" CACHE STRING "")
if(VTKm_ENABLE_CUDA)
set(CMAKE_CUDA_COMPILER_LAUNCHER "sccache" CACHE STRING "")
endif()

16
.gitlab/ci/config/sccache.sh Executable file

@ -0,0 +1,16 @@
#!/bin/sh
set -e
readonly version="0.2.12"
readonly sha256sum="26fd04c1273952cc2a0f359a71c8a1857137f0ee3634058b3f4a63b69fc8eb7f"
readonly filename="sccache-$version-x86_64-unknown-linux-musl"
readonly tarball="$filename.tar.gz"
cd .gitlab
echo "$sha256sum $tarball" > sccache.sha256sum
curl -OL "https://github.com/mozilla/sccache/releases/download/$version/$tarball"
sha256sum --check sccache.sha256sum
tar xf "$tarball"
mv "$filename/sccache" .

@ -0,0 +1,32 @@
##=============================================================================
##
## 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.
##
##=============================================================================
cmake_minimum_required(VERSION 3.8)
# Read the files from the build directory that contain
# host information ( name, parallel level, etc )
include("$ENV{CI_PROJECT_DIR}/build/CIState.cmake")
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
# Pick up from where the configure left off.
ctest_start(APPEND)
message(STATUS "CTEST_BUILD_FLAGS: ${CTEST_BUILD_FLAGS}")
ctest_build(APPEND
NUMBER_WARNINGS num_warnings
RETURN_VALUE build_result)
ctest_submit(PARTS Build)
if (build_result)
message(FATAL_ERROR
"Failed to build")
endif ()

@ -0,0 +1,44 @@
##=============================================================================
##
## 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.
##
##=============================================================================
cmake_minimum_required(VERSION 3.8)
# Read the files from the build directory that contain
# host information ( name, parallel level, etc )
include("$ENV{CI_PROJECT_DIR}/build/CIState.cmake")
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
set(cmake_args
-C "${CMAKE_CURRENT_LIST_DIR}/config/initial_config.cmake")
# Create an entry in CDash.
ctest_start(Experimental TRACK "${CTEST_TRACK}")
# Gather update information.
find_package(Git)
set(CTEST_UPDATE_VERSION_ONLY ON)
set(CTEST_UPDATE_COMMAND "${GIT_EXECUTABLE}")
ctest_update()
# Configure the project.
ctest_configure(APPEND
OPTIONS "${cmake_args}"
RETURN_VALUE configure_result)
# We can now submit because we've configured. This is a cmb-superbuild-ism.
ctest_submit(PARTS Update)
ctest_submit(PARTS Configure)
if (configure_result)
message(FATAL_ERROR
"Failed to configure")
endif ()

@ -0,0 +1,41 @@
##=============================================================================
##
## 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.
##
##=============================================================================
# Read the files from the build directory that contain
# host information ( name, parallel level, etc )
include("$ENV{CI_PROJECT_DIR}/build/CIState.cmake")
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
# Pick up from where the configure left off.
ctest_start(APPEND)
set(test_exclusions
# placeholder for tests to exclude
)
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
endif ()
ctest_test(APPEND
PARALLEL_LEVEL "10"
RETURN_VALUE test_result
EXCLUDE "${test_exclusions}"
REPEAT "UNTIL_PASS:3"
)
ctest_submit(PARTS Test)
if (test_result)
message(FATAL_ERROR
"Failed to test")
endif ()

@ -0,0 +1,21 @@
FROM nvidia/cuda:10.2-devel-centos7
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
RUN yum install cmake make gcc gcc-c++ -y
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash
RUN yum install git git-lfs -y
# Provide a consistent CMake path across all images
# Install CMake 3.13 as it is the minium for cuda builds
RUN mkdir /opt/cmake && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5-Linux-x86_64.sh > cmake-3.13.5-Linux-x86_64.sh && \
sh cmake-3.13.5-Linux-x86_64.sh --prefix=/opt/cmake/ --exclude-subdir --skip-license
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

@ -0,0 +1,18 @@
FROM nvidia/cuda:10.2-devel-ubi8
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
RUN yum install cmake make gcc gcc-c++ curl -y
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash
RUN yum install git git-lfs -y
# Provide a consistent CMake path across all images
RUN mkdir -p /opt/cmake/bin && ln -s /usr/bin/cmake /opt/cmake/bin/cmake
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

@ -0,0 +1,51 @@
FROM ubuntu:16.04
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
# Base dependencies for building VTK-m projects
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
clang-3.8 \
clang-5.0 \
curl \
g++ \
g++-4.8 \
libtbb-dev \
make \
ninja-build \
software-properties-common \
ssh
# extra dependencies for dejagore machine
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get install -y --no-install-recommends \
git \
git-lfs \
&& \
rm -rf /var/lib/apt/lists/*
# Provide a modern OpenMPI verion that supports
# running as root via environment variables
RUN mkdir /opt/openmpi && \
curl -L https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz > openmpi-4.0.3.tar.gz && \
tar -xf openmpi-4.0.3.tar.gz && \
cd openmpi-4.0.3 && \
./configure --prefix=/opt/openmpi && \
make -j all && \
make install
# Provide a consistent CMake path across all images
# Install CMake 3.8 as it is the minium for non-cuda builds
RUN mkdir /opt/cmake && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.8.2/cmake-3.8.2-Linux-x86_64.sh > cmake-3.8.2-Linux-x86_64.sh && \
sh cmake-3.8.2-Linux-x86_64.sh --prefix=/opt/cmake/ --exclude-subdir --skip-license
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

@ -0,0 +1,49 @@
FROM nvidia/cuda:9.2-devel-ubuntu16.04
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
# Base dependencies for building VTK-m projects
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
curl \
g++ \
libomp-dev \
libtbb-dev \
make \
ninja-build \
software-properties-common \
ssh
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
git-lfs \
&& \
rm -rf /var/lib/apt/lists/*
# Provide a modern OpenMPI verion that supports
# running as root via environment variables
RUN mkdir /opt/openmpi && \
curl -L https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz > openmpi-4.0.3.tar.gz && \
tar -xf openmpi-4.0.3.tar.gz && \
cd openmpi-4.0.3 && \
./configure --prefix=/opt/openmpi && \
make -j all && \
make install
# Provide a consistent CMake path across all images
# Allow tests that require CMake to work correctly
# Install CMake 3.13 as it is the minium for cuda builds
RUN mkdir /opt/cmake && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.13.5/cmake-3.13.5-Linux-x86_64.sh > cmake-3.13.5-Linux-x86_64.sh && \
sh cmake-3.13.5-Linux-x86_64.sh --prefix=/opt/cmake/ --exclude-subdir --skip-license
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

@ -0,0 +1,43 @@
FROM ubuntu:18.04
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
# Base dependencies for building VTK-m projects
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
curl \
g++ \
git \
git-lfs \
libmpich-dev \
libomp-dev \
libtbb-dev \
mpich \
ninja-build \
software-properties-common
# extra dependencies for charm machine
RUN add-apt-repository ppa:jonathonf/gcc-9.2
RUN apt-get update && apt-get install -y --no-install-recommends \
clang-8 \
g++-9 \
&& \
rm -rf /var/lib/apt/lists/*
# Need to run git-lfs install manually on ubuntu based images when using the
# system packaged version
RUN git-lfs install
# Provide a consistent CMake path across all images
# Allow tests that require CMake to work correctly
RUN mkdir /opt/cmake && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.sh > cmake-3.16.4-Linux-x86_64.sh && \
sh cmake-3.16.4-Linux-x86_64.sh --prefix=/opt/cmake/ --exclude-subdir --skip-license
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

@ -0,0 +1,35 @@
FROM nvidia/cuda:10.1-devel-ubuntu18.04
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
# Base dependencies for building VTK-m projects
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
g++ \
git \
git-lfs \
libmpich-dev \
libomp-dev \
libtbb-dev \
mpich \
ninja-build \
&& \
rm -rf /var/lib/apt/lists/*
# Need to run git-lfs install manually on ubuntu based images when using the
# system packaged version
RUN git-lfs install
# Provide a consistent CMake path across all images
# Allow tests that require CMake to work correctly
RUN mkdir /opt/cmake && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.sh > cmake-3.16.4-Linux-x86_64.sh && \
sh cmake-3.16.4-Linux-x86_64.sh --prefix=/opt/cmake/ --exclude-subdir --skip-license
# Provide CMake 3.17 so we can re-run tests easily
# This will be used when we run just the tests
RUN mkdir /opt/cmake-latest/ && \
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"

35
.gitlab/ci/docker/update_all.sh Executable file

@ -0,0 +1,35 @@
#!/bin/sh
set -e
set -x
# data is expected to be a string of the form YYYYMMDD
readonly date="$1"
cd centos7/cuda10.2
sudo docker build -t kitware/vtkm:ci-centos7_cuda10.2-$date .
cd ../..
cd rhel8/cuda10.2
sudo docker build -t kitware/vtkm:ci-rhel8_cuda10.2-$date .
cd ../..
cd ubuntu1604/base
sudo docker build -t kitware/vtkm:ci-ubuntu1604-$date .
cd ../..
cd ubuntu1604/cuda9.2
sudo docker build -t kitware/vtkm:ci-ubuntu1604_cuda9.2-$date .
cd ../..
cd ubuntu1804/base
sudo docker build -t kitware/vtkm:ci-ubuntu1804-$date .
cd ../..
cd ubuntu1804/cuda10.1
sudo docker build -t kitware/vtkm:ci-ubuntu1804_cuda10.1-$date .
cd ../..
# sudo docker login --username=<docker_hub_name>
sudo docker push kitware/vtkm
sudo docker system prune

29
.gitlab/ci/rhel8.yml Normal file

@ -0,0 +1,29 @@
# Build on rhel8 with serial and test on rhel8
# Uses gcc 8.2.1
build:rhel8:
tags:
- build
- vtkm
- docker
- linux
extends:
- .rhel8
- .cmake_build_linux
variables:
CMAKE_GENERATOR: "Unix Makefiles"
VTKM_SETTINGS: "serial+shared+64bit_floats+32bit_ids"
test:rhel8:
tags:
- test
- vtkm
- docker
- linux
extends:
- .rhel8
- .cmake_test_linux
dependencies:
- build:rhel8
needs:
- build:rhel8

93
.gitlab/ci/ubuntu1604.yml Normal file

@ -0,0 +1,93 @@
# Build on ubuntu1604 with CUDA 9.2 and test on ubuntu1604 and ubuntu1804
# Uses gcc 5, and build for pascal as CUDA 9.2 doesn't support turing
build:ubuntu1604_gcc5:
tags:
- build
- vtkm
- docker
- linux
- large-memory
extends:
- .ubuntu1604_cuda
- .cmake_build_linux
variables:
CMAKE_BUILD_TYPE: RelWithDebInfo
VTKM_SETTINGS: "cuda+pascal"
# Temporarily disabled as we don't have a pascal hw gitlab-runner
# test:ubuntu1604_gcc5:
# tags:
# - test
# - cuda-rt
# - pascal
# - vtkm
# - docker
# - linux
# extends:
# - .ubuntu1604_cuda
# - .cmake_test_linux
# dependencies:
# - build:ubuntu1604_gcc5
# needs:
# - build:ubuntu1604_gcc5
# test:ubuntu1804_test_ubuntu1604_gcc5:
# tags:
# - test
# - cuda-rt
# - pascal
# - vtkm
# - docker
# - linux
# extends:
# - .ubuntu1804_cuda
# - .cmake_test_linux
# dependencies:
# - build:ubuntu1604_gcc5
# needs:
# - build:ubuntu1604_gcc5
# Build on ubuntu1604 with mpi + tbb and test on ubuntu1604
# Uses gcc 4.8
# Uses OpenMPI
build:ubuntu1604_gcc48:
tags:
- build
- vtkm
- docker
- linux
extends:
#Requires the cuda docker image as it uses a sufficiently new
#enough CMake version that supports mpi
- .ubuntu1604_cuda
- .cmake_build_linux
variables:
CMAKE_BUILD_TYPE: Release
#custom openmpi install location
CMAKE_PREFIX_PATH: "/opt/openmpi/"
VTKM_SETTINGS: "tbb+mpi"
test:ubuntu1604_gcc48:
tags:
- test
- vtkm
- docker
- linux
extends:
- .ubuntu1604
- .cmake_test_linux
variables:
#env flags to allow openmpi to run as root user
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
dependencies:
- build:ubuntu1604_gcc48
needs:
- build:ubuntu1604_gcc48
# Todo:
# Build on ubuntu1604 with TBB and test on ubuntu1804
# Uses clang 3.8
# Build on ubuntu1604 with TBB and test on ubuntu1604 and ubuntu1804
# Uses clang 5.0, Debug??, Static/shared?

97
.gitlab/ci/ubuntu1804.yml Normal file

@ -0,0 +1,97 @@
# Build on ubuntu1804 with TBB and OpenMP and test on ubuntu1804
# Uses gcc 9
# Uses MPICH2
build:ubuntu1804_gcc9:
tags:
- build
- vtkm
- docker
- linux
extends:
- .ubuntu1804
- .cmake_build_linux
variables:
CC: "gcc-9"
CXX: "g++-9"
CMAKE_BUILD_TYPE: Debug
VTKM_SETTINGS: "tbb+openmp+mpi"
test:ubuntu1804_gcc9:
tags:
- test
- vtkm
- docker
- linux
extends:
- .ubuntu1804
- .cmake_test_linux
dependencies:
- build:ubuntu1804_gcc9
needs:
- build:ubuntu1804_gcc9
# Build on ubuntu1804 with CUDA + MPI and test on ubuntu1804
# Uses gcc 7.4
# Uses MPICH2
build:ubuntu1804_gcc7:
tags:
- build
- vtkm
- docker
- linux
- large-memory
extends:
- .ubuntu1804_cuda
- .cmake_build_linux
variables:
CC: "gcc-7"
CXX: "g++-7"
VTKM_SETTINGS: "cuda+turing+mpi+64bit_floats"
test:ubuntu1804_gcc7:
tags:
- test
- cuda-rt
- turing
- vtkm
- docker
- linux
extends:
- .ubuntu1804_cuda
- .cmake_test_linux
dependencies:
- build:ubuntu1804_gcc7
needs:
- build:ubuntu1804_gcc7
# Build on ubuntu1804 with TBB and test on ubuntu1804
# Uses clang 8
build:ubuntu1804_clang8:
tags:
- build
- vtkm
- docker
- linux
extends:
- .ubuntu1804
- .cmake_build_linux
variables:
CC: "clang-8"
CXX: "clang++-8"
CMAKE_BUILD_TYPE: Debug
VTKM_SETTINGS: "tbb+shared"
test:ubuntu1804_clang8:
tags:
- test
- vtkm
- docker
- linux
extends:
- .ubuntu1804
- .cmake_test_linux
dependencies:
- build:ubuntu1804_clang8
needs:
- build:ubuntu1804_clang8

@ -32,14 +32,14 @@ Before you begin, perform initial setup:
This will prompt for your GitLab user name and configure a remote
called `gitlab` to refer to it.
5. (Optional but highly recommended.)
5. (Optional but highly recommended.)
[Register with the VTK-m dashboard] on Kitware's CDash instance to
better know how your code performs in regression tests. After
registering and signing in, click on "All Dashboards" link in the upper
left corner, scroll down and click "Subscribe to this project" on the
right of VTK-m.
6. (Optional but highly recommended.)
6. (Optional but highly recommended.)
[Sign up for the VTK-m mailing list] to communicate with other
developers and users.
@ -108,6 +108,9 @@ idea of the feature or fix to be developed given just the branch name.
This is required as VTK-m uses Git-LFS to efficiently support data
files.
4. If you are adding a new feature or making sigificant changes to API,
make sure to add a entry to `docs/changelog`. This allows release
notes to properly capture all relevant changes.
### Guidelines for Commit Messages ###
@ -203,7 +206,7 @@ will be filled out for you.
5. In the "**Description**" field provide a high-level description of the
change the topic makes and any relevant information about how to try
it.
it.
* Use `@username` syntax to draw attention of specific developers.
This syntax may be used anywhere outside literal text and code
blocks. Or, wait until the [next step](#review-a-merge-request)
@ -226,6 +229,10 @@ will be filled out for you.
6. The "**Assign to**", "**Milestone**", and "**Labels**" fields may be
left blank.
7. Enable the "**Allow commits from members who can merge to the target branch.**" option,
so that reviewers can modify the merge request. This allows reviewers to change
minor style issues without overwhelming the author with change requests.
7. Use the "**Submit merge request**" button to create the merge request
and visit its page.
@ -318,32 +325,49 @@ succeeds.
### Testing ###
VTK-m has a [buildbot](http://buildbot.net) instance watching for merge
requests to test. Each time a merge request is updated the buildbot user
(@buildbot) will automatically trigger a new build on all VTK-m buildbot
workers. The buildbot user (@buildbot) will respond with a comment linking
to the CDash results when it schedules builds.
Each time a merge request is created or updated automated testing
is automatically triggered, and shows up under the pipeline tab.
The buildbot user (@buildbot) will also respond to any comment with the
form:
Developers can track the status of the pipeline for a merge
request by using the Pipeline tab on a merge request or by
clicking on stage icons as shown below:
![alt text](docs/build_stage.png "Pipeline")
When trying to diagnose why a build or tests stage has failed it
generally is easier to look at the pruned information reported
on [VTK-m's CDash Dashboard](https://open.cdash.org/index.php?project=VTKM).
To make it easier to see only the results for a given merge request
you can click the `cdash` link under the external stage ( rightmost pipeline stage icon )
![alt text](docs/external_stage.png "CDash Link")
In addition to the gitlab pipelines the buildbot user (@buildbot) will respond
with a comment linking to the CDash results when it schedules builds.
The builds for VTK-m that show up as part of the `external` stage of the
gitlab pipeline are driven via buildbot, and have a different workflow.
When you need to do things such as retry a build, you must issue commands
via comments of the following form. The buildbot user (@buildbot) will
respond signify that the command has been executed
Do: test
The `Do: test` command accepts the following arguments:
* `--oneshot`
* `--oneshot`
only build the *current* hash of the branch; updates will not be
built using this command
* `--stop`
* `--stop`
clear the list of commands for the merge request
* `--superbuild`
* `--superbuild`
build the superbuilds related to the project
* `--clear`
* `--clear`
clear previous commands before adding this command
* `--regex-include <arg>` or `-i <arg>`
* `--regex-include <arg>` or `-i <arg>`
only build on builders matching `<arg>` (a Python regular
expression)
* `--regex-exclude <arg>` or `-e <arg>`
* `--regex-exclude <arg>` or `-e <arg>`
excludes builds on builders matching `<arg>` (a Python regular
expression)
@ -451,7 +475,7 @@ will stop running so that you can make changes. Make the changes you need,
use `git add` to stage those changes, and then use
$ git rebase --continue
to have git continue the rebase process. You can always run `git status` to
get help about what to do next.

230
docs/CI-README.md Normal file

@ -0,0 +1,230 @@
Gitlab CI
===============
# High level view
1. Kitware Gitlab CI
- Why pipelines
- Gitlab runner tags
2. How to use docker builders locally
- Setting up docker
- Setting up nvidia runtime
- Running docker images
3. How to Add/Update Kitware Gitlab CI
- How to add a new builder
- How to add a new tester
- How to update an existing docker image
4. ECP OSTI CI
- Issues
# Kitware Gitlab CI
GitLab CI/CD allows for software development through continous integration, delivery, and deployment.
VTK-m uses continuous integration to verify every merge request, by running a pipeline of scripts to build, test,
the code changes across a wide range of hardware and configurations before merging them into master.
This workflow allow everyone to easily catch build failures, bugs, and errors before VTK-m is deployed in a
production enviornment. Making sure VTK-m is a robust library provides not only confidence to our users
but to every VTK-m developer. When the system is working developers can be confident that failures
seen during CI are related to the specific changes they have made.
GitLab CI/CD is configured by a file called `.gitlab-ci.yml` located at the root of the VTK-m repository.
The scripts set in this file are executed by the [GitLab Runners](https://docs.gitlab.com/runner/) associated with VTK-m.
## Why pipelines
Pipelines are the top-level component of continuous integration. For VTK-m the pipeline contains build and test stages, with the possibilty of adding subsequent stages such as coverage, or memory checking.
Decomposing the build and test into separate components comes with some significant benifits for VTK-m developers.
The most impactful change is that we now have the ability to compile VTK-m on dedicated 'compilation' machines and
test on machines with less memory or an older CPU improving turnaround time. Additionally since we are heavily
leveraging docker, VTK-m build stages can be better load balanced across the set of builders as we don't have
a tight coupling between a machine and build configuration.
## Gitlab runner tags
Current gitlab runner tags for VTK-m are:
- build
Signifies that this is will be doing compilation
- test
Signifies that this is will be running tests
- vtkm
Allows us to make sure VTK-m ci is only run on VTK-m allocated hardware
- docker
Used to state that the gitlab-runner must support docker based ci
- linux
Used to state that we require a linux based gitlab-runner
- large-memory
Used to state that this step will require a machine that has lots of memory.
This is currently used for cuda `build` requests
- cuda-rt
Used to state that the runner is required to have the cuda runtime enviornment.
This isn't required to `build` VTK-m, only `test`
- maxwell
- pascal
- turing
Only used on a `test` stage to signifiy which GPU hardware is required to
run the VTK-m tests
# How to use docker builders locally
## Setting up docker
## Setting up nvidia runtime
## Running docker images
# How to Add/Update Kitware Gitlab CI
Adding new build or test stages is necessary when a given combination of compiler, platform,
and VTK-m options isn't already captured by existing builders. Each definition is composed via 3 components; tags, variables, and extends.
Tags are used to by gitlab-ci to match a given build to a set of possible execution locations.
Therefore we encode information such as we require docker or the linux kernel into tags.
The full set of VTK-m tags each meaning are found under the `runner tags` section of the document.
Extends is used to compose the execution enviornment of the builder. Basically this means
setting up the correct build/test enviornment and specifying the CMake scripts that need
to be executed. So a linux docker based builder would extend the docker image they want,
plus `.cmake_build_linux`. A MacOS builder would extend `.cmake_build_macos`.
Variables control stage specific information such as runtime enviornment variables,
or VTK-m CMake options.
## How to add a new builder
Each builder definition is placed inside the respective OS `yml` file located in
`.gitlab/ci/`. Therefore if you are adding a builder that will run on Ubuntu 20.04 it
would go into `.gitlab/ci/ubuntu2004.yml`.
Variables are used to control the following components:
- Compiler
- VTK-m CMake Options
- Static / Shared
- Release / Debug / MinSizeRel
An example defitinon of a builder would look like:
```yml
build:ubuntu2004_$<compiler>:
tags:
- build
- vtkm
- docker
- linux
extends:
- .ubuntu2004
- .cmake_build_linux
variables:
CC: "$<c-compiler-command>"
CXX: "$<cxx-compiler-command>"
CMAKE_BUILD_TYPE: "Debug|Release|MinSizeRel"
VTKM_SETTINGS: "tbb+openmp+mpi"
```
If this builder requires a new docker image a coupe of extra steps are required
1. Add the docker image to the proper folder under `.gitlab/ci/docker`. Images
are laid out with the primary folder being the OS and the secondary folder the
primary device adapter it adds. We currently consider `openmp` and `tbb` to
be small enough to be part of any image.
2. Make sure image is part of the `update_all.sh` script, following the convention
of `platform_device`.
3. Update the `.gitlab-ci.yml` comments to list what compiler(s), device adapters,
and other relevant libraries the image has.
4. Verify the image is part of the `.gitlab-ci.yml` file and uses the docker image
pattern, as seen below. This is important as `.docker_image` makes sure we
have consistent paths across all builds to allow us to cache compilation object
files.
```yml
.$<platform>_$<device>: &$<platform>_$<device>
image: "kitware/vtkm:ci-$<platform>_$<device>-$<YYYYMMDD>"
extends:
- .docker_image
```
## How to add a new tester
Each test definition is placed inside the respective OS `yml` file located in
`.gitlab/ci/`. Therefore if you are adding a builder that will run on Ubuntu 20.04 it
would go into `.gitlab/ci/ubuntu2004.yml`.
The primary difference between tests and build definitions are that tests have
the dependencies and needs sections. These are required as by default
gitlab-ci will not run any test stage before ALL the build stages have
completed.
Variables for testers are currently only used for the following things:
- Allowing OpenMPI to run as root
An example defitinon of a tester would look like:
```yml
test:ubuntu2004_$<compiler>:
tags:
- test
- cuda-rt
- turing
- vtkm
- docker
- linux
extends:
- .ubuntu2004_cuda
- .cmake_test_linux
dependencies:
- build:ubuntu2004_$<compiler>
needs:
- build:ubuntu2004_$<compiler>
```
## How to update an existing docker image
Updating an image to be used for CI infrastructure can be done by anyone that
has permissions to the kitware/vtkm dockerhub project, as that is where
images are stored.
Each modification of the docker image requires a new name so that existing open
merge requests can safely trigger pipelines without inadverntly using the
updated images which might break their build.
Therefore the workflow to update images is
1. Start a new git branch
2. Update the associated `Dockerfile`
3. Locally build the docker image
4. Push the docker image to dockerhub
5. Open a Merge Request
To simplify step 3 and 4 of the process, VTK-m has a script (`update_all.sh`) that automates
these stages. This script is required to be run from the `.gitlab/ci/docker` directory, and
needs to have the date string passed to it. An example of running the script:
```sh
sudo docker login --username=<docker_hub_name>
cd .gitlab/ci/docker
sudo ./update_all.sh 20201230
```
# ECP OSTI CI
`.gitlab-ci-ecp.yml` allows for VTK-m to run CI on provided by ECP at NMC.
To have this work properly you will need to make sure that the gitlab repository
has been updated to this non-standard yaml file location
( "Settings" -> "CI/CD" -> "General pipelines" -> "Custom CI configuration path").
The ECP CI is setup to verify VTK-m mainly on Power9 hardware as that currently is
missing from VTK-m standard CI infrastructure.
Currently we verify Power9 support with `cuda` and `openmp` builders. The `cuda` builder
is setup to use the default cuda SDK on the machine and the required `c++` compiler which
currently is `gcc-4.8.5`. The `openmp` builder is setup to use the newest `c++` compiler provided
on the machine so that we maximimze compiler coverage.
## Issues
Currently these builders don't report back to the VTK-m CDash instance.

BIN
docs/build_stage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

@ -0,0 +1,53 @@
# Configurable default types
Because VTK-m compiles efficient code for accelerator architectures, it
often has to compile for static types. This means that dynamic types often
have to be determined at runtime and converted to static types. This is the
reason for the `CastAndCall` architecture in VTK-m.
For this `CastAndCall` to work, there has to be a finite set of static
types to try at runtime. If you don't compile in the types you need, you
will get runtime errors. However, the more types you compile in, the longer
the compile time and executable size. Thus, getting the types right is
important.
The "right" types to use can change depending on the application using
VTK-m. For example, when VTK links in VTK-m, it needs to support lots of
types and can sacrifice the compile times to do so. However, if using VTK-m
in situ with a fortran simulation, space and time are critical and you
might only need to worry about double SoA arrays.
Thus, it is important to customize what types VTK-m uses based on the
application. This leads to the oxymoronic phrase of configuring the default
types used by VTK-m.
This is being implemented by providing VTK-m with a header file that
defines the default types. The header file provided to VTK-m should define
one or more of the following preprocessor macros:
* `VTKM_DEFAULT_TYPE_LIST` - a `vtkm::List` of value types for fields that
filters should directly operate on (where applicable).
* `VTKM_DEFAULT_STORAGE_LIST` - a `vtkm::List` of storage tags for fields
that filters should directly operate on.
* `VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED` - a `vtkm::List` of
`vtkm::cont::CellSet` types that filters should operate on as a
strutured cell set.
* `VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED` - a `vtkm::List` of
`vtkm::cont::CellSet` types that filters should operate on as an
unstrutured cell set.
* `VTKM_DEFAULT_CELL_SET_LIST` - a `vtkm::List` of `vtkm::cont::CellSet`
types that filters should operate on (where applicable). The default of
`vtkm::ListAppend<VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED, VTKM_DEFAULT_CELL_SET_LIST>`
is usually correct.
If any of these macros are not defined, a default version will be defined.
(This is the same default used if no header file is provided.)
This header file is provided to the build by setting the
`VTKm_DEFAULT_TYPES_HEADER` CMake variable. `VTKm_DEFAULT_TYPES_HEADER`
points to the file, which will be configured and copied to VTK-m's build
directory.
For convenience, header files can be added to the VTK_m source directory
(conventionally under vtkm/cont/internal). If this is the case, an advanced
CMake option should be added to select the provided header file.

BIN
docs/external_stage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

@ -113,3 +113,6 @@ add_subdirectory(io)
#add the source folder
add_subdirectory(source)
#add Pseudo Random Number Generator folder
add_subdirectory(random)

@ -50,16 +50,19 @@ struct UniversalTag
//-----------------------------------------------------------------------------
/// A basic tag for a list of typenames. This struct can be subclassed
/// and still behave like a list tag.
/// @cond NONE
template <typename... ArgTypes>
struct VTKM_DEPRECATED(1.6, "ListTagBase replace by List. Note that List cannot be subclassed.")
ListTagBase : detail::ListRoot
{
using list = detail::ListBase<ArgTypes...>;
};
/// @endcond
/// A special tag for a list that represents holding all potential values
///
/// Note: Can not be used with ForEach for obvious reasons.
/// @cond NONE
struct VTKM_DEPRECATED(
1.6,
"ListTagUniversal replaced by ListUniversal. Note that ListUniversal cannot be subclassed.")
@ -67,26 +70,31 @@ struct VTKM_DEPRECATED(
{
using list = vtkm::detail::ListBase<vtkm::detail::UniversalTag>;
};
/// @endcond
namespace internal
{
/// @cond NONE
template <typename ListTag>
struct ListTagCheck : std::is_base_of<vtkm::detail::ListRoot, ListTag>
{
static constexpr bool Valid = std::is_base_of<vtkm::detail::ListRoot, ListTag>::value;
};
/// @endcond
} // namespace internal
namespace detail
{
/// @cond NONE
template <typename ListTag>
struct VTKM_DEPRECATED(1.6, "VTKM_IS_LIST_TAG replaced with VTKM_IS_LIST.") ListTagAssert
: internal::IsList<ListTag>
{
};
/// @endcond
} // namespace detal
@ -105,6 +113,7 @@ namespace internal
namespace detail
{
/// @cond NONE
template <typename ListTag>
struct ListTagAsBrigandListImpl
{
@ -113,6 +122,7 @@ struct ListTagAsBrigandListImpl
using type = typename ListTag::list;
VTKM_DEPRECATED_SUPPRESS_END
};
/// @endcond
} // namespace detail
@ -181,6 +191,7 @@ using ListTagApply VTKM_DEPRECATED(1.6, "ListTagApply replaced by ListApply.") =
/// A special tag for an empty list.
///
/// @cond NONE
struct VTKM_DEPRECATED(
1.6,
"ListTagEmpty replaced by ListEmpty. Note that ListEmpty cannot be subclassed.") ListTagEmpty
@ -188,9 +199,11 @@ struct VTKM_DEPRECATED(
{
using list = vtkm::detail::ListBase<>;
};
/// @endcond
/// A tag that is a construction of two other tags joined together. This struct
/// can be subclassed and still behave like a list tag.
/// @cond NONE
template <typename... ListTags>
struct VTKM_DEPRECATED(
1.6,
@ -198,9 +211,11 @@ struct VTKM_DEPRECATED(
: vtkm::internal::ListAsListTag<vtkm::ListAppend<ListTags...>>
{
};
/// @endcond
/// A tag that is constructed by appending \c Type to \c ListTag.
/// @cond NONE
template <typename ListTag, typename Type>
struct VTKM_DEPRECATED(1.6,
"ListTagAppend<List, Type> replaced by ListAppend<List, vtkm::List<Type>. "
@ -208,9 +223,11 @@ struct VTKM_DEPRECATED(1.6,
: vtkm::internal::ListAsListTag<vtkm::ListAppend<ListTag, vtkm::List<Type>>>
{
};
/// @endcond
/// Append \c Type to \c ListTag only if \c ListTag does not already contain \c Type.
/// No checks are performed to see if \c ListTag itself has only unique elements.
/// @cond NONE
template <typename ListTag, typename Type>
struct VTKM_DEPRECATED(1.6) ListTagAppendUnique
: std::conditional<
@ -219,9 +236,11 @@ struct VTKM_DEPRECATED(1.6) ListTagAppendUnique
vtkm::internal::ListAsListTag<vtkm::ListAppend<ListTag, vtkm::List<Type>>>>::type
{
};
/// @endcond
/// A tag that consists of elements that are found in both tags. This struct
/// can be subclassed and still behave like a list tag.
/// @cond NONE
template <typename ListTag1, typename ListTag2>
struct VTKM_DEPRECATED(
1.6,
@ -229,9 +248,11 @@ struct VTKM_DEPRECATED(
ListTagIntersect : vtkm::internal::ListAsListTag<vtkm::ListIntersect<ListTag1, ListTag2>>
{
};
/// @endcond
/// A list tag that consists of each item in another list tag fed into a template that takes
/// a single parameter.
/// @cond NONE
template <typename ListTag, template <typename> class Transform>
struct VTKM_DEPRECATED(
1.6,
@ -239,6 +260,7 @@ struct VTKM_DEPRECATED(
ListTagTransform : vtkm::internal::ListAsListTag<vtkm::ListTransform<ListTag, Transform>>
{
};
/// @endcond
/// A list tag that takes an existing ListTag and a predicate template that is applied to
/// each type in the ListTag. Any type in the ListTag that has a value element equal to true
@ -253,6 +275,7 @@ struct VTKM_DEPRECATED(
/// `std::is_integral<int>` and `std::is_integral<long long>` resolve to `std::true_type`
/// whereas `std::is_integral<float>` and `std::is_integral<double>` resolve to
/// `std::false_type`.
/// @cond NONE
template <typename ListTag, template <typename> class Predicate>
struct VTKM_DEPRECATED(
1.6,
@ -260,6 +283,7 @@ struct VTKM_DEPRECATED(
ListTagRemoveIf : vtkm::internal::ListAsListTag<vtkm::ListRemoveIf<ListTag, Predicate>>
{
};
/// @endcond
namespace detail
{
@ -273,6 +297,7 @@ using ListToBrigand = vtkm::ListApply<List, brigand::list>;
/// Generate a tag that is the cross product of two other tags. The resulting
/// tag has the form of Tag< brigand::list<A1,B1>, brigand::list<A1,B2> .... >
///
/// @cond NONE
template <typename ListTag1, typename ListTag2>
struct VTKM_DEPRECATED(
1.6,
@ -282,17 +307,20 @@ struct VTKM_DEPRECATED(
vtkm::ListTransform<vtkm::ListCross<ListTag1, ListTag2>, detail::ListToBrigand>>
{
};
/// @endcond
/// \brief Checks to see if the given \c Type is in the list pointed to by \c ListTag.
///
/// There is a static boolean named \c value that is set to true if the type is
/// contained in the list and false otherwise.
///
/// @cond NONE
template <typename ListTag, typename Type>
struct VTKM_DEPRECATED(1.6, "ListContains replaced by ListHas.") ListContains
: vtkm::ListHas<ListTag, Type>
{
};
/// @endcond
/// \brief Finds the type at the given index.
///

@ -10,10 +10,6 @@
#ifndef vtk_m_TypeList_h
#define vtk_m_TypeList_h
#ifndef VTKM_DEFAULT_TYPE_LIST
#define VTKM_DEFAULT_TYPE_LIST ::vtkm::TypeListCommon
#endif
#include <vtkm/List.h>
#include <vtkm/Types.h>

@ -58,14 +58,16 @@ VTK_M_OLD_TYPE_LIST_DEFINITION(VecUncommon);
// Special definition of TypeListTagCommon to give descriptive warning when
// VTKM_DEFAULT_TYPE_LIST_TAG is used.
/// @cond NONE
struct VTKM_ALWAYS_EXPORT
VTKM_DEPRECATED(
1.6,
"VTKM_DEFAULT_TYPE_LIST_TAG replaced by VTKM_DEFAULT_TYPE_LIST. "
"Note that the new VTKM_DEFAULT_TYPE_LIST cannot be subclassed.")
TypeListTagDefault : vtkm::internal::ListAsListTag<VTKM_DEFAULT_TYPE_LIST>
TypeListTagDefault : vtkm::internal::ListAsListTag<vtkm::TypeListCommon>
{
};
/// @endcond
} // namespace internal

@ -211,76 +211,6 @@ struct ScanInclusiveResultFunctor
}
};
template <typename T>
struct StreamingScanExclusiveFunctor
{
T result;
StreamingScanExclusiveFunctor()
: result(T(0))
{
}
template <typename Device, class CIn, class COut>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result =
vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingScanExclusive(numBlocks, input, output);
return true;
}
template <typename Device, class CIn, class COut, class BinaryFunctor>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output,
BinaryFunctor binary_functor,
const T& initialValue)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result = vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingScanExclusive(
numBlocks, input, output, binary_functor, initialValue);
return true;
}
};
template <typename U>
struct StreamingReduceFunctor
{
U result;
StreamingReduceFunctor()
: result(U(0))
{
}
template <typename Device, typename T, class CIn>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result =
vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingReduce(numBlocks, input, initialValue);
return true;
}
template <typename Device, typename T, class CIn, class BinaryFunctor>
VTKM_CONT bool operator()(Device,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U InitialValue,
BinaryFunctor binaryFunctor)
{
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
result = vtkm::cont::DeviceAdapterAlgorithm<Device>::StreamingReduce(
numBlocks, input, InitialValue, binaryFunctor);
return true;
}
};
struct ScanInclusiveByKeyFunctor
{
ScanInclusiveByKeyFunctor() {}
@ -798,66 +728,6 @@ struct Algorithm
}
template <typename T, class CIn, class COut>
VTKM_CONT static T StreamingScanExclusive(vtkm::cont::DeviceAdapterId devId,
const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output)
{
detail::StreamingScanExclusiveFunctor<T> functor;
vtkm::cont::TryExecuteOnDevice(devId, functor, numBlocks, input, output);
return functor.result;
}
template <typename T, class CIn, class COut>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output)
{
return StreamingScanExclusive(vtkm::cont::DeviceAdapterTagAny(), numBlocks, input, output);
}
template <typename T, class CIn, class COut, class BinaryFunctor>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output,
BinaryFunctor binary_functor,
const T& initialValue)
{
detail::StreamingScanExclusiveFunctor<T> functor;
vtkm::cont::TryExecuteOnDevice(vtkm::cont::DeviceAdapterTagAny(),
functor,
numBlocks,
input,
output,
binary_functor,
initialValue);
return functor.result;
}
template <typename T, typename U, class CIn>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue)
{
detail::StreamingReduceFunctor<U> functor;
vtkm::cont::TryExecuteOnDevice(
vtkm::cont::DeviceAdapterTagAny(), functor, numBlocks, input, initialValue);
return functor.result;
}
template <typename T, typename U, class CIn, class BinaryFunctor>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue,
BinaryFunctor binaryFunctor)
{
detail::StreamingReduceFunctor<U> functor;
vtkm::cont::TryExecuteOnDevice(
vtkm::cont::DeviceAdapterTagAny(), functor, numBlocks, input, initialValue, binaryFunctor);
return functor.result;
}
template <typename T, class CIn, class COut, class BinaryFunctor>
VTKM_CONT static T ScanInclusive(vtkm::cont::DeviceAdapterId devId,
const vtkm::cont::ArrayHandle<T, CIn>& input,

@ -381,7 +381,10 @@ public:
VTKM_DEPRECATED(1.6,
"Use ArrayHandle::WritePortal() instead. "
"Note that the returned portal will lock the array while it is in scope.")
/// \cond NOPE
typename StorageType::PortalType GetPortalControl();
/// \endcond
/// Get the array portal of the control array.
/// Since worklet invocations are asynchronous and this routine is a synchronization point,
@ -394,7 +397,9 @@ public:
VTKM_DEPRECATED(1.6,
"Use ArrayHandle::ReadPortal() instead. "
"Note that the returned portal will lock the array while it is in scope.")
/// \cond NOPE
typename StorageType::PortalConstType GetPortalConstControl() const;
/// \endcond
/// \brief Get an array portal that can be used in the control environment.
///
@ -604,8 +609,7 @@ public:
this->SyncControlArray(lock);
}
// Probably should make this private, but ArrayHandleStreaming needs access.
protected:
private:
/// Acquires a lock on the internals of this `ArrayHandle`. The calling
/// function should keep the returned lock and let it go out of scope
/// when the lock is no longer needed.

@ -13,8 +13,6 @@
#include <vtkm/cont/StorageExtrude.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/CoordinateSystem.hxx>
namespace vtkm
{

@ -0,0 +1,98 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_ArrayHandlePhiloxURBG_h
#define vtk_m_cont_ArrayHandlePhiloxURBG_h
#include <random>
#include <vtkm/cont/ArrayHandleImplicit.h>
#include <vtkm/random/Philox.h>
namespace vtkm
{
namespace cont
{
namespace detail
{
struct PhiloxFunctor
{
using SeedType = vtkm::Vec<vtkm::UInt32, 1>;
PhiloxFunctor() = default;
explicit PhiloxFunctor(SeedType seed)
: Seed(seed)
{
}
VTKM_EXEC_CONT
vtkm::UInt64 operator()(vtkm::Id index) const
{
using philox_functor = vtkm::random::PhiloxFunctor2x32x10;
using counters_type = typename philox_functor::counters_type;
auto idx = static_cast<vtkm::UInt64>(index);
counters_type counters{ static_cast<vtkm::UInt32>(idx), static_cast<vtkm::UInt32>(idx >> 32) };
counters_type result = philox_functor{}(counters, Seed);
return static_cast<vtkm::UInt64>(result[0]) | static_cast<vtkm::UInt64>(result[1]) << 32;
}
private:
const SeedType Seed{};
}; // class PhiloxFunctor
} // namespace detail
/// \brief An \c ArrayHandle that provides a source of random bits
///
/// \c ArrayHandleRandomUniformBits is a specialization of ArrayHandleImplicit.
/// It takes a user supplied seed and hash it with the a given index value. The
/// hashed value is the value of the array at that position.
///
/// Currently, Philox2x32x10 as described in the
/// "Parallel Random Numbers: As Easy as 1, 2, 3," Proceedings of the
/// International Conference for High Performance Computing, Networking,
/// Storage and Analysis (SC11)
/// is used as the hash function.
///
/// Note: In contrast to traditional random number generator,
/// ArrayHandleRandomUniformBits does not have "state", i.e. multiple calls
/// the Get() method with the same index will always return the same hash value.
/// To ge a new set of random bits, create a new ArrayHandleRandomUniformBits
/// with a different seed.
class VTKM_ALWAYS_EXPORT ArrayHandleRandomUniformBits
: public vtkm::cont::ArrayHandleImplicit<detail::PhiloxFunctor>
{
public:
using SeedType = vtkm::Vec<vtkm::UInt32, 1>;
VTKM_ARRAY_HANDLE_SUBCLASS_NT(ArrayHandleRandomUniformBits,
(vtkm::cont::ArrayHandleImplicit<detail::PhiloxFunctor>));
/// The type of seed is specifically designed to be an vtkm::Vec<> to provide
/// type safety for the parameters so user will not transpose two integer parameters.
explicit ArrayHandleRandomUniformBits(vtkm::Id length, SeedType seed = { std::random_device{}() })
: Superclass(detail::PhiloxFunctor(seed), length)
{
}
}; // class ArrayHandleRandomUniformBits
}
} // namespace vtkm::cont
//=============================================================================
// Specializations of serialization related classes
/// @cond SERIALIZATION
namespace vtkm
{
namespace cont
{
}
} // namespace vtkm::cont
#endif //vtk_m_cont_ArrayHandlePhiloxURBG_h

@ -677,6 +677,7 @@ struct Serialization<vtkm::cont::ArrayHandle<ValueType, vtkm::cont::StorageTagSO
};
} // namespace mangled_diy_namespace
// @endcond SERIALIZATION
//=============================================================================
// Precompiled instances

@ -1,310 +0,0 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_ArrayHandleStreaming_h
#define vtk_m_cont_ArrayHandleStreaming_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayPortal.h>
namespace vtkm
{
namespace cont
{
namespace internal
{
template <typename P>
class VTKM_ALWAYS_EXPORT ArrayPortalStreaming
{
using Writable = vtkm::internal::PortalSupportsSets<P>;
public:
using PortalType = P;
using ValueType = typename PortalType::ValueType;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming()
: InputPortal()
, BlockIndex(0)
, BlockSize(0)
, CurBlockSize(0)
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming(const PortalType& inputPortal,
vtkm::Id blockIndex,
vtkm::Id blockSize,
vtkm::Id curBlockSize)
: InputPortal(inputPortal)
, BlockIndex(blockIndex)
, BlockSize(blockSize)
, CurBlockSize(curBlockSize)
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename OtherP>
VTKM_EXEC_CONT ArrayPortalStreaming(const ArrayPortalStreaming<OtherP>& src)
: InputPortal(src.GetPortal())
, BlockIndex(src.GetBlockIndex())
, BlockSize(src.GetBlockSize())
, CurBlockSize(src.GetCurBlockSize())
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming(const ArrayPortalStreaming& src)
: InputPortal(src.InputPortal)
, BlockIndex(src.BlockIndex)
, BlockSize(src.BlockSize)
, CurBlockSize(src.CurBlockSize)
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming(const ArrayPortalStreaming&& rhs)
: InputPortal(std::move(rhs.InputPortal))
, BlockIndex(std::move(rhs.BlockIndex))
, BlockSize(std::move(rhs.BlockSize))
, CurBlockSize(std::move(rhs.CurBlockSize))
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
~ArrayPortalStreaming() {}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming& operator=(const ArrayPortalStreaming& src)
{
this->InputPortal = src.InputPortal;
this->BlockIndex = src.BlockIndex;
this->BlockSize = src.BlockSize;
this->CurBlockSize = src.CurBlockSize;
return *this;
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ArrayPortalStreaming& operator=(const ArrayPortalStreaming&& rhs)
{
this->InputPortal = std::move(rhs.InputPortal);
this->BlockIndex = std::move(rhs.BlockIndex);
this->BlockSize = std::move(rhs.BlockSize);
this->CurBlockSize = std::move(rhs.CurBlockSize);
return *this;
}
VTKM_EXEC_CONT
vtkm::Id GetNumberOfValues() const { return this->CurBlockSize; }
VTKM_EXEC_CONT
ValueType Get(vtkm::Id index) const
{
return this->InputPortal.Get(this->BlockIndex * this->BlockSize + index);
}
template <typename Writable_ = Writable,
typename = typename std::enable_if<Writable_::value>::type>
VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const
{
this->InputPortal.Set(this->BlockIndex * this->BlockSize + index, value);
}
VTKM_EXEC_CONT
const PortalType& GetPortal() const { return this->InputPortal; }
VTKM_EXEC_CONT
void SetBlockSize(vtkm::Id blockSize) { this->BlockSize = blockSize; }
VTKM_EXEC_CONT
void SetBlockIndex(vtkm::Id blockIndex) { this->BlockIndex = blockIndex; }
VTKM_EXEC_CONT
void SetCurBlockSize(vtkm::Id curBlockSize) { this->CurBlockSize = curBlockSize; }
VTKM_EXEC_CONT
vtkm::Id GetBlockSize() { return this->BlockSize; }
VTKM_EXEC_CONT
vtkm::Id GetBlockIndex() { return this->BlockIndex; }
VTKM_EXEC_CONT
vtkm::Id GetCurBlockSize() { return this->CurBlockSize; }
private:
PortalType InputPortal;
vtkm::Id BlockIndex;
vtkm::Id BlockSize;
vtkm::Id CurBlockSize;
};
} // internal
template <typename ArrayHandleInputType>
struct VTKM_ALWAYS_EXPORT StorageTagStreaming
{
};
namespace internal
{
template <typename ArrayHandleInputType>
class Storage<typename ArrayHandleInputType::ValueType, StorageTagStreaming<ArrayHandleInputType>>
{
public:
using ValueType = typename ArrayHandleInputType::ValueType;
using PortalType = vtkm::cont::internal::ArrayPortalStreaming<
typename vtkm::cont::internal::Storage<typename ArrayHandleInputType::ValueType,
typename ArrayHandleInputType::StorageTag>::PortalType>;
using PortalConstType =
vtkm::cont::internal::ArrayPortalStreaming<typename vtkm::cont::internal::Storage<
typename ArrayHandleInputType::ValueType,
typename ArrayHandleInputType::StorageTag>::PortalConstType>;
VTKM_CONT
Storage()
: Valid(false)
{
}
VTKM_CONT
Storage(const ArrayHandleInputType inputArray,
vtkm::Id blockSize,
vtkm::Id blockIndex,
vtkm::Id curBlockSize)
: InputArray(inputArray)
, BlockSize(blockSize)
, BlockIndex(blockIndex)
, CurBlockSize(curBlockSize)
, Valid(true)
{
}
VTKM_CONT
PortalType GetPortal()
{
VTKM_ASSERT(this->Valid);
return PortalType(this->InputArray.WritePortal(), BlockSize, BlockIndex, CurBlockSize);
}
VTKM_CONT
PortalConstType GetPortalConst() const
{
VTKM_ASSERT(this->Valid);
return PortalConstType(this->InputArray.ReadPortal(), BlockSize, BlockIndex, CurBlockSize);
}
VTKM_CONT
vtkm::Id GetNumberOfValues() const
{
VTKM_ASSERT(this->Valid);
return CurBlockSize;
}
VTKM_CONT
void Allocate(vtkm::Id numberOfValues) const
{
(void)numberOfValues;
// Do nothing, since we only allocate a streaming array once at the beginning
}
VTKM_CONT
void AllocateFullArray(vtkm::Id numberOfValues)
{
VTKM_ASSERT(this->Valid);
this->InputArray.Allocate(numberOfValues);
}
VTKM_CONT
void Shrink(vtkm::Id numberOfValues)
{
VTKM_ASSERT(this->Valid);
this->InputArray.Shrink(numberOfValues);
}
VTKM_CONT
void ReleaseResources()
{
VTKM_ASSERT(this->Valid);
this->InputArray.ReleaseResources();
}
VTKM_CONT
const ArrayHandleInputType& GetArray() const
{
VTKM_ASSERT(this->Valid);
return this->InputArray;
}
private:
ArrayHandleInputType InputArray;
vtkm::Id BlockSize;
vtkm::Id BlockIndex;
vtkm::Id CurBlockSize;
bool Valid;
};
}
}
}
namespace vtkm
{
namespace cont
{
template <typename ArrayHandleInputType>
class ArrayHandleStreaming
: public vtkm::cont::ArrayHandle<typename ArrayHandleInputType::ValueType,
StorageTagStreaming<ArrayHandleInputType>>
{
public:
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleStreaming,
(ArrayHandleStreaming<ArrayHandleInputType>),
(vtkm::cont::ArrayHandle<typename ArrayHandleInputType::ValueType,
StorageTagStreaming<ArrayHandleInputType>>));
private:
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
public:
VTKM_CONT
ArrayHandleStreaming(const ArrayHandleInputType& inputArray,
const vtkm::Id blockIndex,
const vtkm::Id blockSize,
const vtkm::Id curBlockSize)
: Superclass(StorageType(inputArray, blockIndex, blockSize, curBlockSize))
{
this->ReadPortal().SetBlockIndex(blockIndex);
this->ReadPortal().SetBlockSize(blockSize);
this->ReadPortal().SetCurBlockSize(curBlockSize);
}
VTKM_CONT
void AllocateFullArray(vtkm::Id numberOfValues)
{
auto lock = this->GetLock();
this->ReleaseResourcesExecutionInternal(lock);
this->Internals->GetControlArray(lock)->AllocateFullArray(numberOfValues);
this->Internals->SetControlArrayValid(lock, true);
}
};
}
}
#endif //vtk_m_cont_ArrayHandleStreaming_h

@ -270,5 +270,6 @@ VTK_M_ARRAY_HANDLE_VIRTUAL_EXPORT(vtkm::Float64);
}
} //namespace vtkm::cont
/// @endcond SERIALIZATION
#endif //vtk_m_cont_ArrayHandleVirtual_h

@ -25,6 +25,7 @@ namespace cont
/// \brief A type list containing types that can be used with an AtomicArray.
///
/// @cond NONE
using AtomicArrayTypeList = vtkm::List<vtkm::UInt32, vtkm::Int32, vtkm::UInt64, vtkm::Int64>;
struct VTKM_DEPRECATED(1.6,
@ -33,6 +34,7 @@ struct VTKM_DEPRECATED(1.6,
: vtkm::internal::ListAsListTag<AtomicArrayTypeList>
{
};
/// @endcond
/// A class that can be used to atomically operate on an array of values safely
@ -88,7 +90,9 @@ public:
}
private:
/// @cond NONE
vtkm::cont::ArrayHandle<T> Handle;
/// @endcond
};
}
} // namespace vtkm::exec

@ -32,8 +32,8 @@ set(headers
ArrayHandleMultiplexer.h
ArrayHandlePermutation.h
ArrayHandleReverse.h
ArrayHandleRandomUniformBits.h
ArrayHandleSOA.h
ArrayHandleStreaming.h
ArrayHandleSwizzle.h
ArrayHandleTransform.h
ArrayHandleUniformPointCoordinates.h
@ -189,6 +189,39 @@ set(sources
Timer.cxx
)
#-----------------------------------------------------------------------------
# Set up default types, which can be custom configured by other build systems.
vtkm_get_kit_name(kit_name kit_dir)
# Some custom types included with VTK-m
option(VTKm_USE_DEFAULT_TYPES_FOR_VTK "Compile VTK-m algorithms for use with types from VTK." OFF)
if (VTKm_USE_DEFAULT_TYPES_FOR_VTK)
set(VTKm_DEFAULT_TYPES_HEADER "internal/DefaultTypesVTK.h.in")
endif()
mark_as_advanced(VTKm_USE_DEFAULT_TYPES_FOR_VTK)
if (VTKm_DEFAULT_TYPES_HEADER)
set(VTK_M_HAS_DEFAULT_TYPES_HEADER TRUE)
get_filename_component(VTKm_DEFAULT_TYPES_HEADER_FILENAME ${VTKm_DEFAULT_TYPES_HEADER} NAME_WE)
set(VTKm_DEFAULT_TYPES_HEADER_FILENAME "${VTKm_DEFAULT_TYPES_HEADER_FILENAME}.h")
configure_file(${VTKm_DEFAULT_TYPES_HEADER}
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/internal/${VTKm_DEFAULT_TYPES_HEADER_FILENAME}
@ONLY
)
vtkm_install_headers(vtkm/cont/internal
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/internal/${VTKm_DEFAULT_TYPES_HEADER_FILENAME}
)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DefaultTypes.h.in
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/DefaultTypes.h
@ONLY
)
vtkm_install_headers(vtkm/cont
${VTKm_BINARY_INCLUDE_DIR}/${kit_dir}/DefaultTypes.h
)
#-----------------------------------------------------------------------------
vtkm_library( NAME vtkm_cont
SOURCES ${sources}

@ -15,9 +15,6 @@
#include <vtkm/StaticAssert.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/Field.h>
#include <vtkm/cont/VariantArrayHandle.h>
namespace vtkm
{

@ -10,10 +10,6 @@
#ifndef vtk_m_cont_CellSetList_h
#define vtk_m_cont_CellSetList_h
#ifndef VTKM_DEFAULT_CELL_SET_LIST
#define VTKM_DEFAULT_CELL_SET_LIST ::vtkm::cont::CellSetListCommon
#endif
#include <vtkm/List.h>
#include <vtkm/cont/CellSetExplicit.h>

@ -42,6 +42,7 @@ VTK_M_OLD_CELL_LIST_DEFINITION(Common);
VTK_M_OLD_CELL_LIST_DEFINITION(Structured);
VTK_M_OLD_CELL_LIST_DEFINITION(Unstructured);
/// @cond NONE
template <typename ShapesStorageTag = VTKM_DEFAULT_SHAPES_STORAGE_TAG,
typename ConnectivityStorageTag = VTKM_DEFAULT_CONNECTIVITY_STORAGE_TAG,
typename OffsetsStorageTag = VTKM_DEFAULT_OFFSETS_STORAGE_TAG>
@ -53,10 +54,12 @@ struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
CellSetListExplicit<ShapesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>>
{
};
/// @endcond
namespace detail
{
/// @cond NONE
struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
1.6,
"VTKM_DEFAULT_CELL_SET_LIST_TAG replaced by VTKM_DEFAULT_CELL_SET_LIST. "
@ -64,6 +67,7 @@ struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
: vtkm::internal::ListAsListTag<VTKM_DEFAULT_CELL_SET_LIST>
{
};
/// @endcond
} // namespace detail
}

@ -15,6 +15,7 @@
#include <vtkm/TopologyElementTag.h>
#include <vtkm/cont/CellSet.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ErrorBadType.h>
#include <vtkm/exec/ConnectivityStructured.h>
#include <vtkm/internal/ConnectivityStructuredInternals.h>

@ -38,7 +38,10 @@ public:
const vtkm::cont::VariantArrayHandleBase<TypeList>& data);
template <typename T, typename Storage>
VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle<T, Storage>& data);
VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle<T, Storage>& data)
: Superclass(name, Association::POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data))
{
}
/// This constructor of coordinate system sets up a regular grid of points.
///

@ -56,13 +56,6 @@ VTKM_CONT CoordinateSystem::CoordinateSystem(
{
}
template <typename T, typename Storage>
VTKM_CONT CoordinateSystem::CoordinateSystem(std::string name,
const vtkm::cont::ArrayHandle<T, Storage>& data)
: Superclass(name, Association::POINTS, vtkm::cont::ArrayHandleVirtualCoordinates(data))
{
}
template <typename T, typename Storage>
VTKM_CONT void CoordinateSystem::SetData(const vtkm::cont::ArrayHandle<T, Storage>& newdata)
{

104
vtkm/cont/DefaultTypes.h.in Normal file

@ -0,0 +1,104 @@
//============================================================================
// 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.
//============================================================================
// The intention of the header file is to configure VTK-m to compile its algorithms
// and filters for some set of types and data storage. You can customize the types
// for which VTK-m is compiled for by setting the VTKm_DEFAULT_TYPES_HEADER CMake
// variable. This CMake variable can be set to a header file that defines one or
// more of the following macros:
//
// VTKM_FIELD_TYPE_LIST - a vtkm::List of value types for fields that filters
// should directly operate on (where applicable).
// VTKM_FIELD_STORAGE_LIST - a vtkm::List of storage tags for fields that
// filters should directly operate on.
// VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED - a vtkm::List of vtkm::cont::CellSet types
// that filters should operate on as a strutured cell set.
// VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED - a vtkm::List of vtkm::cont::CellSet types
// that filters should operate on as an unstrutured cell set.
// VTKM_DEFAULT_CELL_SET_LIST - a vtkm::List of vtkm::cont::CellSet types that filters
// should operate on (where applicable). The default of
// vtkm::ListAppend<VTKM_STRUCTURED_CELL_SET_LIST, VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED>
// is usually correct.
//
// Note that if you specify VTKm_DEFAULT_TYPES_HEADER, that file will be copied
// to the VTK-m build directory. Thus, be careful about editing the file included
// by this one (if it exists).
#ifndef vtk_m_cont_DefaultTypes_h
#define vtk_m_cont_DefaultTypes_h
#cmakedefine VTK_M_HAS_DEFAULT_TYPES_HEADER
#ifdef VTK_M_HAS_DEFAULT_TYPES_HEADER
#include "internal/@VTKm_DEFAULT_TYPES_HEADER_FILENAME@"
#endif
#ifndef VTKM_DEFAULT_TYPE_LIST
#include <vtkm/TypeList.h>
#define VTKM_DEFAULT_TYPE_LIST ::vtkm::TypeListCommon
#endif //VTKM_DEFAULT_TYPE_LIST
#ifndef VTKM_DEFAULT_STORAGE_LIST
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/cont/StorageList.h>
namespace vtkm
{
namespace cont
{
namespace internal
{
using StorageListField = vtkm::ListAppend<
vtkm::cont::StorageListBasic,
vtkm::List<
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32>>::StorageTag,
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64>>::StorageTag>>;
}
}
} // namespace vtkm::cont
#define VTKM_DEFAULT_STORAGE_LIST ::vtkm::cont::internal::StorageListField
#endif // VTKM_FIELD_STORAGE_LIST
#ifndef VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED
#include <vtkm/cont/CellSetList.h>
#define VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED ::vtkm::cont::CellSetListStructured
#endif // VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED
#ifndef VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED
#include <vtkm/cont/CellSetList.h>
#define VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED ::vtkm::cont::CellSetListUnstructured
#endif // VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED
#ifndef VTKM_DEFAULT_CELL_SET_LIST
namespace vtkm
{
namespace cont
{
namespace internal
{
using CellSetList = vtkm::ListAppend<VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED, VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED>;
}
}
} // namespace vtkm::cont::internal
#define VTKM_DEFAULT_CELL_SET_LIST ::vtkm::cont::internal::CellSetList
#endif // VTKM_CELL_SET_LIST
#endif //vtk_m_cont_DefaultTypes_h

@ -368,17 +368,6 @@ struct DeviceAdapterAlgorithm
const vtkm::cont::ArrayHandle<U, VIn>& values,
vtkm::cont::ArrayHandle<U, VOut>& output);
/// \brief Streaming version of scan exclusive
///
/// Computes a scan one block at a time.
///
/// \return The total sum.
///
template <typename T, class CIn, class COut>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output);
/// \brief Compute an extended prefix sum operation on the input ArrayHandle.
///
/// Computes an extended prefix sum operation on the \c input ArrayHandle,

@ -25,16 +25,19 @@ namespace vtkm
namespace cont
{
/// @cond NONE
struct VTKM_DEPRECATED(1.6,
"DeviceAdapterListTagCommon replaced by DeviceAdapterListCommon. "
"Note that the new DeviceAdapterListCommon cannot be subclassed.")
DeviceAdapterListTagCommon : vtkm::internal::ListAsListTag<DeviceAdapterListCommon>
{
};
/// @endcond
namespace detail
{
/// @cond NONE
struct VTKM_DEPRECATED(
1.6,
"VTKM_DEFAULT_DEVICE_ADAPTER_LIST_TAG replaced by VTKM_DEFAULT_DEVICE_ADAPTER_LIST. "
@ -42,6 +45,7 @@ struct VTKM_DEPRECATED(
DeviceAdapterListTagDefault : vtkm::internal::ListAsListTag<VTKM_DEFAULT_DEVICE_ADAPTER_LIST>
{
};
/// @endcond
} // namespace detail
}

@ -13,6 +13,7 @@
#include <vtkm/cont/CastAndCall.h>
#include <vtkm/cont/CellSet.h>
#include <vtkm/cont/CellSetList.h>
#include <vtkm/cont/DefaultTypes.h>
#include <vtkm/cont/ErrorBadValue.h>
#include <vtkm/cont/Logging.h>

@ -10,10 +10,6 @@
#ifndef vtk_m_cont_StorageList_h
#define vtk_m_cont_StorageList_h
#ifndef VTKM_DEFAULT_STORAGE_LIST
#define VTKM_DEFAULT_STORAGE_LIST ::vtkm::cont::StorageListBasic
#endif
#include <vtkm/List.h>
#include <vtkm/cont/Storage.h>
@ -25,10 +21,6 @@ namespace cont
{
using StorageListBasic = vtkm::List<vtkm::cont::StorageTagBasic>;
// If we want to compile VTK-m with support of memory layouts other than the basic layout, then
// add the appropriate storage tags here.
using StorageListSupported = vtkm::List<vtkm::cont::StorageTagBasic>;
}
} // namespace vtkm::cont

@ -31,15 +31,19 @@ struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
"Note that the new StorageListBasic cannot be subclassed.") StorageListTagBasic
: vtkm::internal::ListAsListTag<StorageListBasic>
{
/// @cond NONE
};
/// @endcond
struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
1.6,
"StorageListTagSupported replaced by StorageListSupported. "
"StorageListTagSupported replaced by StorageListBasic. "
"Note that the new StorageListSupported cannot be subclassed.") StorageListTagSupported
: vtkm::internal::ListAsListTag<StorageListSupported>
: vtkm::internal::ListAsListTag<StorageListBasic>
{
/// @cond NONE
};
/// @endcond
namespace detail
{
@ -48,9 +52,11 @@ struct VTKM_ALWAYS_EXPORT VTKM_DEPRECATED(
1.6,
"VTKM_DEFAULT_STORAGE_LIST_TAG replaced by VTKM_DEFAULT_STORAGE_LIST. "
"Note that the new VTKM_DEFAULT_STORAGE_LIST cannot be subclassed.") StorageListTagDefault
: vtkm::internal::ListAsListTag<VTKM_DEFAULT_STORAGE_LIST>
: vtkm::internal::ListAsListTag<vtkm::cont::StorageListBasic>
{
/// @cond NONE
};
/// @endcond
} // namespace detail
}

@ -19,6 +19,7 @@
#include <vtkm/cont/ArrayHandleTransform.h>
#include <vtkm/cont/ArrayHandleVirtual.h>
#include <vtkm/cont/CastAndCall.h>
#include <vtkm/cont/DefaultTypes.h>
#include <vtkm/cont/ErrorBadType.h>
#include <vtkm/cont/Logging.h>
#include <vtkm/cont/StorageList.h>

@ -27,7 +27,9 @@ set(headers
TransportTagWholeArrayInOut.h
TransportTagWholeArrayOut.h
TypeCheck.h
TypeCheckTagArray.h
TypeCheckTagArrayIn.h
TypeCheckTagArrayInOut.h
TypeCheckTagArrayOut.h
TypeCheckTagAtomicArray.h
TypeCheckTagBitField.h
TypeCheckTagCellSet.h

@ -1,42 +0,0 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_arg_TypeCheckTagArray_h
#define vtk_m_cont_arg_TypeCheckTagArray_h
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/List.h>
#include <vtkm/cont/ArrayHandle.h>
namespace vtkm
{
namespace cont
{
namespace arg
{
/// The Array type check passes for any object that behaves like an \c
/// ArrayHandle class and can be passed to the ArrayIn and ArrayOut transports.
///
struct TypeCheckTagArray
{
};
template <typename ArrayType>
struct TypeCheck<TypeCheckTagArray, ArrayType>
{
static constexpr bool value = vtkm::cont::internal::ArrayHandleCheck<ArrayType>::type::value;
};
}
}
} // namespace vtkm::cont::arg
#endif //vtk_m_cont_arg_TypeCheckTagArray_h

@ -0,0 +1,66 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_arg_TypeCheckTagArrayIn_h
#define vtk_m_cont_arg_TypeCheckTagArrayIn_h
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/List.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/internal/ArrayPortalHelpers.h>
namespace vtkm
{
namespace cont
{
namespace arg
{
/// The Array type check passes for any object that behaves like an \c
/// ArrayHandle class and can be passed to the ArrayIn transport.
///
struct TypeCheckTagArrayIn
{
};
namespace detail
{
template <typename ArrayType,
bool IsArrayHandle = vtkm::cont::internal::ArrayHandleCheck<ArrayType>::type::value>
struct IsArrayHandleIn;
template <typename ArrayType>
struct IsArrayHandleIn<ArrayType, true>
{
static constexpr bool value =
vtkm::internal::PortalSupportsGets<typename ArrayType::ReadPortalType>::value;
};
template <typename ArrayType>
struct IsArrayHandleIn<ArrayType, false>
{
static constexpr bool value = false;
};
} // namespace detail
template <typename ArrayType>
struct TypeCheck<TypeCheckTagArrayIn, ArrayType>
{
static constexpr bool value = detail::IsArrayHandleIn<ArrayType>::value;
};
}
}
} // namespace vtkm::cont::arg
#endif //vtk_m_cont_arg_TypeCheckTagArray_h

@ -0,0 +1,67 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_arg_TypeCheckTagArrayInOut_h
#define vtk_m_cont_arg_TypeCheckTagArrayInOut_h
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/List.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/internal/ArrayPortalHelpers.h>
namespace vtkm
{
namespace cont
{
namespace arg
{
/// The Array type check passes for any object that behaves like an
/// `ArrayHandle` class and can be passed to the ArrayInOut transport.
///
struct TypeCheckTagArrayInOut
{
};
namespace detail
{
template <typename ArrayType,
bool IsArrayHandle = vtkm::cont::internal::ArrayHandleCheck<ArrayType>::type::value>
struct IsArrayHandleInOut;
template <typename ArrayType>
struct IsArrayHandleInOut<ArrayType, true>
{
static constexpr bool value =
(vtkm::internal::PortalSupportsGets<typename ArrayType::ReadPortalType>::value &&
vtkm::internal::PortalSupportsSets<typename ArrayType::WritePortalType>::value);
};
template <typename ArrayType>
struct IsArrayHandleInOut<ArrayType, false>
{
static constexpr bool value = false;
};
} // namespace detail
template <typename ArrayType>
struct TypeCheck<TypeCheckTagArrayInOut, ArrayType>
{
static constexpr bool value = detail::IsArrayHandleInOut<ArrayType>::value;
};
}
}
} // namespace vtkm::cont::arg
#endif //vtk_m_cont_arg_TypeCheckTagArray_h

@ -0,0 +1,67 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_cont_arg_TypeCheckTagArrayOut_h
#define vtk_m_cont_arg_TypeCheckTagArrayOut_h
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/List.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/internal/ArrayPortalHelpers.h>
namespace vtkm
{
namespace cont
{
namespace arg
{
/// The Array type check passes for any object that behaves like an
/// `ArrayHandle` class and can be passed to the ArrayOut transport.
///
struct TypeCheckTagArrayOut
{
};
namespace detail
{
template <typename ArrayType,
bool IsArrayHandle = vtkm::cont::internal::ArrayHandleCheck<ArrayType>::type::value>
struct IsArrayHandleOut;
template <typename ArrayType>
struct IsArrayHandleOut<ArrayType, true>
{
static constexpr bool value =
(vtkm::internal::PortalSupportsGets<typename ArrayType::ReadPortalType>::value &&
vtkm::internal::PortalSupportsSets<typename ArrayType::WritePortalType>::value);
};
template <typename ArrayType>
struct IsArrayHandleOut<ArrayType, false>
{
static constexpr bool value = false;
};
} // namespace detail
template <typename ArrayType>
struct TypeCheck<TypeCheckTagArrayOut, ArrayType>
{
static constexpr bool value = detail::IsArrayHandleOut<ArrayType>::value;
};
}
}
} // namespace vtkm::cont::arg
#endif //vtk_m_cont_arg_TypeCheckTagArray_h

@ -12,7 +12,7 @@
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/cont/CellSet.h>
#include <vtkm/cont/CellSetStructured.h>
namespace vtkm
{

@ -8,7 +8,9 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/arg/TypeCheckTagArray.h>
#include <vtkm/cont/arg/TypeCheckTagArrayIn.h>
#include <vtkm/cont/arg/TypeCheckTagArrayInOut.h>
#include <vtkm/cont/arg/TypeCheckTagArrayOut.h>
#include <vtkm/cont/arg/TypeCheckTagAtomicArray.h>
#include <vtkm/cont/ArrayHandle.h>
@ -26,27 +28,50 @@ struct TryArraysOfType
void operator()(T) const
{
using vtkm::cont::arg::TypeCheck;
using vtkm::cont::arg::TypeCheckTagArray;
using vtkm::cont::arg::TypeCheckTagArrayIn;
using vtkm::cont::arg::TypeCheckTagArrayInOut;
using vtkm::cont::arg::TypeCheckTagArrayOut;
using StandardArray = vtkm::cont::ArrayHandle<T>;
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArray, StandardArray>::value),
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayIn, StandardArray>::value),
"Standard array type check failed.");
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayInOut, StandardArray>::value),
"Standard array type check failed.");
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayOut, StandardArray>::value),
"Standard array type check failed.");
using CountingArray = vtkm::cont::ArrayHandleCounting<T>;
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArray, CountingArray>::value),
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayIn, CountingArray>::value),
"Counting array type check failed.");
VTKM_TEST_ASSERT((!TypeCheck<TypeCheckTagArrayInOut, CountingArray>::value),
"Counting array type check failed.");
VTKM_TEST_ASSERT((!TypeCheck<TypeCheckTagArrayOut, CountingArray>::value),
"Counting array type check failed.");
using CompositeArray = vtkm::cont::ArrayHandleCompositeVector<StandardArray, CountingArray>;
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArray, CompositeArray>::value),
using CompositeArray = vtkm::cont::ArrayHandleCompositeVector<StandardArray, StandardArray>;
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayIn, CompositeArray>::value),
"Composite array type check failed.");
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayInOut, CompositeArray>::value),
"Counting array type check failed.");
VTKM_TEST_ASSERT((TypeCheck<TypeCheckTagArrayOut, CompositeArray>::value),
"Counting array type check failed.");
// Just some type that is not a valid array.
using NotAnArray = typename StandardArray::WritePortalType;
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArray, NotAnArray>::value),
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayIn, NotAnArray>::value),
"Not an array type check failed.");
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayInOut, NotAnArray>::value),
"Not an array type check failed.");
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayOut, NotAnArray>::value),
"Not an array type check failed.");
// Another type that is not a valid array.
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArray, T>::value), "Not an array type check failed.");
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayIn, T>::value),
"Not an array type check failed.");
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayInOut, T>::value),
"Not an array type check failed.");
VTKM_TEST_ASSERT(!(TypeCheck<TypeCheckTagArrayOut, T>::value),
"Not an array type check failed.");
}
};

@ -1862,25 +1862,19 @@ class DeviceTaskTypes<vtkm::cont::DeviceAdapterTagCuda>
{
public:
template <typename WorkletType, typename InvocationType>
static vtkm::exec::cuda::internal::TaskStrided1D<WorkletType, InvocationType> MakeTask(
WorkletType& worklet,
InvocationType& invocation,
vtkm::Id,
vtkm::Id globalIndexOffset = 0)
static vtkm::exec::cuda::internal::TaskStrided1D<WorkletType, InvocationType>
MakeTask(WorkletType& worklet, InvocationType& invocation, vtkm::Id)
{
using Task = vtkm::exec::cuda::internal::TaskStrided1D<WorkletType, InvocationType>;
return Task(worklet, invocation, globalIndexOffset);
return Task(worklet, invocation);
}
template <typename WorkletType, typename InvocationType>
static vtkm::exec::cuda::internal::TaskStrided3D<WorkletType, InvocationType> MakeTask(
WorkletType& worklet,
InvocationType& invocation,
vtkm::Id3,
vtkm::Id globalIndexOffset = 0)
static vtkm::exec::cuda::internal::TaskStrided3D<WorkletType, InvocationType>
MakeTask(WorkletType& worklet, InvocationType& invocation, vtkm::Id3)
{
using Task = vtkm::exec::cuda::internal::TaskStrided3D<WorkletType, InvocationType>;
return Task(worklet, invocation, globalIndexOffset);
return Task(worklet, invocation);
}
};
}

@ -405,12 +405,16 @@ public:
VTKM_DEPRECATED(1.6,
"Use ArrayHandle::WritePortal() instead. "
"Note that the returned portal will lock the array while it is in scope.")
/// @cond NONE
typename StorageType::PortalType GetPortalControl();
/// @endcond
VTKM_CONT
VTKM_DEPRECATED(1.6,
"Use ArrayHandle::ReadPortal() instead. "
"Note that the returned portal will lock the array while it is in scope.")
/// @cond NONE
typename StorageType::PortalConstType GetPortalConstControl() const;
/// @endcond
VTKM_CONT ReadPortalType ReadPortal() const;
VTKM_CONT WritePortalType WritePortal() const;

@ -0,0 +1,107 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtkmDefaultTypes_h
#define vtkmDefaultTypes_h
// This configures the default types to use when compiling VTK-m for use as an
// accelerator in VTK.
#include <vtkm/TypeList.h>
#include <vtkm/cont/CellSetList.h>
namespace tovtkm
{
//------------------------------------------------------------------------------
// All scalar types in vtkType.h
using VTKScalarTypes = vtkm::List< //
char, //
signed char, //
unsigned char, //
short, //
unsigned short, //
int, //
unsigned int, //
long, //
unsigned long, //
long long, //
unsigned long long, //
float, //
double //
>;
using SpecialGradientOutTypes =
vtkm::List<vtkm::Vec<vtkm::Vec<vtkm::Float32, 3>, 3>, vtkm::Vec<vtkm::Vec<vtkm::Float64, 3>, 3> >;
using FieldTypeInVTK = vtkm::ListAppend<vtkm::TypeListVecCommon, VTKScalarTypes>;
using FieldTypeOutVTK =
vtkm::ListAppend<vtkm::TypeListVecCommon, SpecialGradientOutTypes, VTKScalarTypes>;
//------------------------------------------------------------------------------
using CellListStructuredInVTK =
vtkm::List<vtkm::cont::CellSetStructured<3>, vtkm::cont::CellSetStructured<2>, vtkm::cont::CellSetStructured<1> >;
using CellListStructuredOutVTK = CellListStructuredInVTK;
// vtkCellArray may use either 32 or 64 bit arrays to hold connectivity/offset
// data, so we may be using ArrayHandleCast to convert to vtkm::Ids.
#ifdef VTKM_USE_64BIT_IDS
using Int32AOSHandle = vtkm::cont::ArrayHandle<vtkm::Int32>;
using Int32AsIdAOSHandle = vtkm::cont::ArrayHandleCast<vtkm::Id, Int32AOSHandle>;
using Int32AsIdAOSStorage = typename Int32AsIdAOSHandle::StorageTag;
using CellSetExplicit32Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
Int32AsIdAOSStorage, Int32AsIdAOSStorage>;
using CellSetExplicit64Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic>;
using CellSetSingleType32Bit = vtkm::cont::CellSetSingleType<Int32AsIdAOSStorage>;
using CellSetSingleType64Bit = vtkm::cont::CellSetSingleType<vtkm::cont::StorageTagBasic>;
#else // VTKM_USE_64BIT_IDS
using Int64AOSHandle = vtkm::cont::ArrayHandle<vtkm::Int64, vtkm::cont::StorageTagBasic>;
using Int64AsIdAOSHandle = vtkm::cont::ArrayHandleCast<vtkm::Id, Int64AOSHandle>;
using Int64AsIdAOSStorage = typename Int64AsIdAOSHandle::StorageTag;
using CellSetExplicit32Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic>;
using CellSetExplicit64Bit = vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic,
Int64AsIdAOSStorage, Int64AsIdAOSStorage>;
using CellSetSingleType32Bit = vtkm::cont::CellSetSingleType<vtkm::cont::StorageTagBasic>;
using CellSetSingleType64Bit = vtkm::cont::CellSetSingleType<Int64AsIdAOSStorage>;
#endif // VTKM_USE_64BIT_IDS
//------------------------------------------------------------------------------
using CellListUnstructuredInVTK = vtkm::List< //
CellSetExplicit32Bit, //
CellSetExplicit64Bit, //
CellSetSingleType32Bit, //
CellSetSingleType64Bit //
>;
using CellListUnstructuredOutVTK = vtkm::List< //
vtkm::cont::CellSetExplicit<>, //
vtkm::cont::CellSetSingleType<>, //
CellSetExplicit32Bit, //
CellSetExplicit64Bit, //
CellSetSingleType32Bit, //
CellSetSingleType64Bit //
>;
//------------------------------------------------------------------------------
using CellListAllInVTK = vtkm::ListAppend<CellListStructuredInVTK, CellListUnstructuredInVTK>;
using CellListAllOutVTK = vtkm::ListAppend<CellListStructuredOutVTK, CellListUnstructuredOutVTK>;
} // end namespace tovtkm
#define VTKM_DEFAULT_TYPE_LIST ::tovtkm::FieldTypeInVTK
#define VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED ::tovtkm::CellListStructuredInVTK
#define VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED ::tovtkm::CellListUnstructuredInVTK
#endif //vtkmDefaultTypes_h

@ -15,7 +15,6 @@
#include <vtkm/cont/ArrayHandleDiscard.h>
#include <vtkm/cont/ArrayHandleImplicit.h>
#include <vtkm/cont/ArrayHandleIndex.h>
#include <vtkm/cont/ArrayHandleStreaming.h>
#include <vtkm/cont/ArrayHandleView.h>
#include <vtkm/cont/ArrayHandleZip.h>
#include <vtkm/cont/BitField.h>
@ -569,49 +568,6 @@ public:
return scanResult;
}
//--------------------------------------------------------------------------
// Streaming Reduce
template <typename T, typename U, class CIn>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue)
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
return DerivedAlgorithm::StreamingReduce(numBlocks, input, initialValue, vtkm::Add());
}
template <typename T, typename U, class CIn, class BinaryFunctor>
VTKM_CONT static U StreamingReduce(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
U initialValue,
BinaryFunctor binary_functor)
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
vtkm::Id fullSize = input.GetNumberOfValues();
vtkm::Id blockSize = fullSize / numBlocks;
if (fullSize % numBlocks != 0)
blockSize += 1;
U lastResult = vtkm::TypeTraits<U>::ZeroInitialization();
for (vtkm::Id block = 0; block < numBlocks; block++)
{
vtkm::Id numberOfInstances = blockSize;
if (block == numBlocks - 1)
numberOfInstances = fullSize - blockSize * block;
vtkm::cont::ArrayHandleStreaming<vtkm::cont::ArrayHandle<T, CIn>> streamIn(
input, block, blockSize, numberOfInstances);
if (block == 0)
lastResult = DerivedAlgorithm::Reduce(streamIn, initialValue, binary_functor);
else
lastResult = DerivedAlgorithm::Reduce(streamIn, lastResult, binary_functor);
}
return lastResult;
}
//--------------------------------------------------------------------------
// Reduce By Key
template <typename T,
@ -857,63 +813,6 @@ public:
keys, values, output, vtkm::TypeTraits<ValueT>::ZeroInitialization(), vtkm::Sum());
}
//--------------------------------------------------------------------------
// Streaming exclusive scan
template <typename T, class CIn, class COut>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output)
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
return DerivedAlgorithm::StreamingScanExclusive(
numBlocks, input, output, vtkm::Sum(), vtkm::TypeTraits<T>::ZeroInitialization());
}
template <typename T, class CIn, class COut, class BinaryFunctor>
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
const vtkm::cont::ArrayHandle<T, CIn>& input,
vtkm::cont::ArrayHandle<T, COut>& output,
BinaryFunctor binary_functor,
const T& initialValue)
{
VTKM_LOG_SCOPE_FUNCTION(vtkm::cont::LogLevel::Perf);
vtkm::Id fullSize = input.GetNumberOfValues();
vtkm::Id blockSize = fullSize / numBlocks;
if (fullSize % numBlocks != 0)
blockSize += 1;
T lastResult = vtkm::TypeTraits<T>::ZeroInitialization();
for (vtkm::Id block = 0; block < numBlocks; block++)
{
vtkm::Id numberOfInstances = blockSize;
if (block == numBlocks - 1)
numberOfInstances = fullSize - blockSize * block;
vtkm::cont::ArrayHandleStreaming<vtkm::cont::ArrayHandle<T, CIn>> streamIn(
input, block, blockSize, numberOfInstances);
vtkm::cont::ArrayHandleStreaming<vtkm::cont::ArrayHandle<T, COut>> streamOut(
output, block, blockSize, numberOfInstances);
if (block == 0)
{
streamOut.AllocateFullArray(fullSize);
lastResult =
DerivedAlgorithm::ScanExclusive(streamIn, streamOut, binary_functor, initialValue);
}
else
{
lastResult =
DerivedAlgorithm::ScanExclusive(streamIn, streamOut, binary_functor, lastResult);
}
streamOut.SyncControlArray();
}
return lastResult;
}
//--------------------------------------------------------------------------
// Scan Inclusive
template <typename T, class CIn, class COut>

@ -40,7 +40,9 @@ namespace internal
#endif
// Include from third party.
// @cond NONE
#include <vtkmoptionparser/optionparser.h>
// @endcond
// Now restore the header guards as before so that other includes of (possibly different versions
// of) optionparser.h work as expected.

@ -399,19 +399,17 @@ public:
template <typename WorkletType, typename InvocationType>
static vtkm::exec::openmp::internal::TaskTiling1D MakeTask(const WorkletType& worklet,
const InvocationType& invocation,
vtkm::Id,
vtkm::Id globalIndexOffset = 0)
vtkm::Id)
{
return vtkm::exec::openmp::internal::TaskTiling1D(worklet, invocation, globalIndexOffset);
return vtkm::exec::openmp::internal::TaskTiling1D(worklet, invocation);
}
template <typename WorkletType, typename InvocationType>
static vtkm::exec::openmp::internal::TaskTiling3D MakeTask(const WorkletType& worklet,
const InvocationType& invocation,
vtkm::Id3,
vtkm::Id globalIndexOffset = 0)
vtkm::Id3)
{
return vtkm::exec::openmp::internal::TaskTiling3D(worklet, invocation, globalIndexOffset);
return vtkm::exec::openmp::internal::TaskTiling3D(worklet, invocation);
}
};
}

@ -553,19 +553,17 @@ public:
template <typename WorkletType, typename InvocationType>
static vtkm::exec::serial::internal::TaskTiling1D MakeTask(WorkletType& worklet,
InvocationType& invocation,
vtkm::Id,
vtkm::Id globalIndexOffset = 0)
vtkm::Id)
{
return vtkm::exec::serial::internal::TaskTiling1D(worklet, invocation, globalIndexOffset);
return vtkm::exec::serial::internal::TaskTiling1D(worklet, invocation);
}
template <typename WorkletType, typename InvocationType>
static vtkm::exec::serial::internal::TaskTiling3D MakeTask(WorkletType& worklet,
InvocationType& invocation,
vtkm::Id3,
vtkm::Id globalIndexOffset = 0)
vtkm::Id3)
{
return vtkm::exec::serial::internal::TaskTiling3D(worklet, invocation, globalIndexOffset);
return vtkm::exec::serial::internal::TaskTiling3D(worklet, invocation);
}
};
}

@ -412,19 +412,17 @@ public:
template <typename WorkletType, typename InvocationType>
static vtkm::exec::tbb::internal::TaskTiling1D MakeTask(WorkletType& worklet,
InvocationType& invocation,
vtkm::Id,
vtkm::Id globalIndexOffset = 0)
vtkm::Id)
{
return vtkm::exec::tbb::internal::TaskTiling1D(worklet, invocation, globalIndexOffset);
return vtkm::exec::tbb::internal::TaskTiling1D(worklet, invocation);
}
template <typename WorkletType, typename InvocationType>
static vtkm::exec::tbb::internal::TaskTiling3D MakeTask(WorkletType& worklet,
InvocationType& invocation,
vtkm::Id3,
vtkm::Id globalIndexOffset = 0)
vtkm::Id3)
{
return vtkm::exec::tbb::internal::TaskTiling3D(worklet, invocation, globalIndexOffset);
return vtkm::exec::tbb::internal::TaskTiling3D(worklet, invocation);
}
};
}

@ -47,6 +47,7 @@ set(unit_tests
UnitTestArrayHandleIndex.cxx
UnitTestArrayHandleReverse.cxx
UnitTestArrayHandlePermutation.cxx
UnitTestArrayHandleRandomUniformBits.cxx
UnitTestArrayHandleSwizzle.cxx
UnitTestArrayHandleThreadSafety.cxx
UnitTestArrayHandleTransform.cxx

@ -109,7 +109,6 @@ void ScanTest()
vtkm::Id out;
out = vtkm::cont::Algorithm::ScanInclusive(input, output);
out = vtkm::cont::Algorithm::ScanInclusive(input, output, vtkm::Maximum());
out = vtkm::cont::Algorithm::StreamingScanExclusive(1, input, output);
vtkm::cont::Algorithm::ScanInclusiveByKey(keys, input, output, vtkm::Maximum());
vtkm::cont::Algorithm::ScanInclusiveByKey(keys, input, output);
out = vtkm::cont::Algorithm::ScanExclusive(input, output, vtkm::Maximum(), vtkm::Id(0));

@ -0,0 +1,44 @@
//============================================================================
// 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/ArrayHandleRandomUniformBits.h>
#include <vtkm/cont/testing/Testing.h>
void TestArrayHandleRandomUniformBits()
{
auto actual0 = vtkm::cont::ArrayHandleRandomUniformBits(10, { 0 });
// result from Random123 sample implementation of philox2x32x10
std::vector<vtkm::UInt64> expected0{ 0x6cd10df2ff1dae59, 0x5f3adb6bdcdce855, 0x3fbb6394049f6998,
0xbd592d1202a74512, 0x8a115b62c08084ef, 0x1411803b3bb7eefa,
0x7d138a2280027d0e, 0x318a7703a1da82c5, 0xdcd79c6998975579,
0x6cb1a07c91f81109 };
auto result =
vtkm::cont::testing::test_equal_ArrayHandles(actual0, vtkm::cont::make_ArrayHandle(expected0));
VTKM_TEST_ASSERT(result, result.GetMergedMessage());
// initialize with seed = 100, could be "iteration number" in actual use case.
auto actual100 = vtkm::cont::ArrayHandleRandomUniformBits(10, { 100 });
// result from Random123 sample implementation of philox2x32x10
std::vector<vtkm::UInt64> expected100{
0xbd35360836122ea3, 0xe033b74acce7aa5f, 0xc0fbb65cba93ecd7, 0xe3fee2812b77e480,
0x92e5c7d563767971, 0xd99e952fb054fc19, 0xb8f2adc12094ad29, 0xb7dcb35fea8c27ac,
0x9c7b779e88270c45, 0x7325b123dc32e01d,
};
auto result100 = vtkm::cont::testing::test_equal_ArrayHandles(
actual100, vtkm::cont::make_ArrayHandle(expected100));
VTKM_TEST_ASSERT(result, result.GetMergedMessage());
}
int UnitTestArrayHandleRandomUniformBits(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestArrayHandleRandomUniformBits, argc, argv);
}

@ -110,7 +110,7 @@ struct CheckFunctor
template <typename T>
void operator()(
const vtkm::cont::ArrayHandle<T, typename ArrayHandleWithUnusualStorage<T>::StorageTag>& array,
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagImplicit<UnusualPortal<T>>>& array,
bool& vtkmNotUsed(calledBasic),
bool& calledUnusual,
bool& vtkmNotUsed(calledVirtual)) const
@ -138,6 +138,12 @@ struct CheckFunctor
auto portal = array.ReadPortal();
CheckPortal(portal);
}
template <typename T, typename S>
void operator()(const vtkm::cont::ArrayHandle<T, S>&, bool&, bool&, bool&) const
{
VTKM_TEST_FAIL("Array resolved to unexpected type.");
}
};
template <typename TypeList>

@ -39,13 +39,11 @@ public:
ThreadIndicesBasic(vtkm::Id threadIndex,
vtkm::Id inIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outIndex,
vtkm::Id globalThreadIndexOffset = 0)
vtkm::Id outIndex)
: ThreadIndex(threadIndex)
, InputIndex(inIndex)
, OutputIndex(outIndex)
, VisitIndex(visitIndex)
, GlobalThreadIndexOffset(globalThreadIndexOffset)
{
}
@ -95,18 +93,11 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
/// \brief The global index (for streaming).
///
/// Global index (for streaming)
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->ThreadIndex); }
private:
vtkm::Id ThreadIndex;
vtkm::Id InputIndex;
vtkm::Id OutputIndex;
vtkm::IdComponent VisitIndex;
vtkm::Id GlobalThreadIndexOffset;
};
}
}

@ -36,9 +36,8 @@ public:
vtkm::Id threadIndex1D,
vtkm::Id inIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outIndex,
vtkm::Id globalThreadIndexOffset)
: ThreadIndicesBasic(threadIndex1D, inIndex, visitIndex, outIndex, globalThreadIndexOffset)
vtkm::Id outIndex)
: ThreadIndicesBasic(threadIndex1D, inIndex, visitIndex, outIndex)
, ThreadIndex3D(threadIndex3D)
{
}

@ -38,8 +38,7 @@ public:
vtkm::Id vtkmNotUsed(inputIndex),
vtkm::IdComponent vtkmNotUsed(visitIndex),
vtkm::Id vtkmNotUsed(outputIndex),
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
const LogicalIndexType logicalIndex = detail::Deflate(threadIndex, LogicalIndexType());
const vtkm::Id index = connectivity.LogicalToFlatToIndex(logicalIndex);
@ -51,15 +50,13 @@ public:
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC
ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
vtkm::Id threadIndex1D,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
// This constructor handles multidimensional indices on one-to-one input-to-output
auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -71,7 +68,6 @@ public:
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
VTKM_SUPPRESS_EXEC_WARNINGS
@ -81,8 +77,7 @@ public:
vtkm::Id inputIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outputIndex,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
// This constructor handles multidimensional indices on many-to-many input-to-output
auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -94,7 +89,6 @@ public:
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
//this->CellShape = connectivity.GetCellShape(index);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
/// \brief The logical index into the input domain.
@ -139,9 +133,6 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The input indices of the "from" elements.
///
/// A topology map has "from" and "to" elements (for example from points to
@ -181,7 +172,6 @@ private:
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesIncidentType IndicesIncident;
vtkm::Id GlobalThreadIndexOffset;
};
// Specialization for extrude types.
@ -201,8 +191,7 @@ public:
vtkm::Id vtkmNotUsed(inputIndex),
vtkm::IdComponent vtkmNotUsed(visitIndex),
vtkm::Id vtkmNotUsed(outputIndex),
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
const LogicalIndexType logicalIndex = detail::Deflate(threadIndex, LogicalIndexType());
const vtkm::Id index = connectivity.LogicalToFlatToIndex(logicalIndex);
@ -213,13 +202,11 @@ public:
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
vtkm::Id threadIndex1D,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -230,7 +217,6 @@ public:
this->VisitIndex = 0;
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
@ -238,8 +224,7 @@ public:
vtkm::Id inputIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outputIndex,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
const LogicalIndexType logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -250,7 +235,6 @@ public:
this->VisitIndex = visitIndex;
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
/// \brief The logical index into the input domain.
@ -295,9 +279,6 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The input indices of the "from" elements.
///
/// A topology map has "from" and "to" elements (for example from points to
@ -337,7 +318,6 @@ private:
vtkm::Id OutputIndex;
LogicalIndexType LogicalIndex;
IndicesIncidentType IndicesIncident;
vtkm::Id GlobalThreadIndexOffset;
};
} //namespace arg

@ -46,6 +46,13 @@ inline VTKM_EXEC vtkm::Id3 To3D(vtkm::Vec<vtkm::Id, 1> index)
{
return vtkm::Id3(index[0], 1, 1);
}
/// Given a \c Vec of (semi) arbitrary size, inflate it to a vtkm::Id3 by padding with zeros.
/// \overload
inline VTKM_EXEC vtkm::Id3 To3D(vtkm::Id index)
{
return vtkm::Id3(index, 1, 1);
}
}
/// \brief Container for thread information in a WorkletPointNeighborhood.
@ -61,14 +68,12 @@ public:
vtkm::Id threadIndex1D,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
Dimension>& connectivity)
: State(threadIndex3D, detail::To3D(connectivity.GetPointDimensions()))
, ThreadIndex(threadIndex1D)
, InputIndex(threadIndex1D)
, OutputIndex(threadIndex1D)
, VisitIndex(0)
, GlobalThreadIndexOffset(globalThreadIndexOffset)
{
}
@ -81,14 +86,12 @@ public:
vtkm::Id outputIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
Dimension>& connectivity)
: State(threadIndex3D, detail::To3D(connectivity.GetPointDimensions()))
, ThreadIndex(threadIndex1D)
, InputIndex(inputIndex)
, OutputIndex(outputIndex)
, VisitIndex(visitIndex)
, GlobalThreadIndexOffset(globalThreadIndexOffset)
{
}
@ -100,15 +103,13 @@ public:
vtkm::Id outputIndex,
const vtkm::exec::ConnectivityStructured<vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell,
Dimension>& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
Dimension>& connectivity)
: State(detail::To3D(connectivity.FlatToLogicalToIndex(inputIndex)),
detail::To3D(connectivity.GetPointDimensions()))
, ThreadIndex(threadIndex)
, InputIndex(inputIndex)
, OutputIndex(outputIndex)
, VisitIndex(visitIndex)
, GlobalThreadIndexOffset(globalThreadIndexOffset)
{
}
@ -130,19 +131,12 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
/// \brief The global index (for streaming).
///
/// Global index (for streaming)
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
private:
vtkm::exec::BoundaryState State;
vtkm::Id ThreadIndex;
vtkm::Id InputIndex;
vtkm::Id OutputIndex;
vtkm::IdComponent VisitIndex;
vtkm::Id GlobalThreadIndexOffset;
};
}
}

@ -39,9 +39,8 @@ public:
vtkm::Id inIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outIndex,
const vtkm::exec::internal::ReduceByKeyLookup<P1, P2, P3>& keyLookup,
vtkm::Id globalThreadIndexOffset = 0)
: Superclass(threadIndex, inIndex, visitIndex, outIndex, globalThreadIndexOffset)
const vtkm::exec::internal::ReduceByKeyLookup<P1, P2, P3>& keyLookup)
: Superclass(threadIndex, inIndex, visitIndex, outIndex)
, ValueOffset(keyLookup.Offsets.Get(inIndex))
, NumberOfValues(keyLookup.Counts.Get(inIndex))
{

@ -94,9 +94,8 @@ public:
vtkm::Id inputIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outputIndex,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
: Superclass(threadIndex, inputIndex, visitIndex, outputIndex, globalThreadIndexOffset)
const ConnectivityType& connectivity)
: Superclass(threadIndex, inputIndex, visitIndex, outputIndex)
// The connectivity is stored in the invocation parameter at the given
// input domain index. If this class is being used correctly, the type
// of the domain will match the connectivity type used here. If there is
@ -161,8 +160,7 @@ public:
vtkm::Id inIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outIndex,
const ConnectivityType& connectivity,
vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
this->ThreadIndex = threadIndex;
this->InputIndex = inIndex;
@ -171,13 +169,11 @@ public:
this->LogicalIndex = connectivity.FlatToLogicalToIndex(this->InputIndex);
this->IndicesIncident = connectivity.GetIndices(this->LogicalIndex);
this->CellShape = connectivity.GetCellShape(this->InputIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
VTKM_EXEC ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
vtkm::Id threadIndex1D,
const ConnectivityType& connectivity,
const vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
// This constructor handles multidimensional indices on one-to-one input-to-output
auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -188,7 +184,6 @@ public:
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->CellShape = connectivity.GetCellShape(threadIndex1D);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
VTKM_EXEC ThreadIndicesTopologyMap(const vtkm::Id3& threadIndex3D,
@ -196,8 +191,7 @@ public:
vtkm::Id inIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outIndex,
const ConnectivityType& connectivity,
const vtkm::Id globalThreadIndexOffset = 0)
const ConnectivityType& connectivity)
{
// This constructor handles multidimensional indices on many-to-many input-to-output
auto logicalIndex = detail::Deflate(threadIndex3D, LogicalIndexType());
@ -208,7 +202,6 @@ public:
this->LogicalIndex = logicalIndex;
this->IndicesIncident = connectivity.GetIndices(logicalIndex);
this->CellShape = connectivity.GetCellShape(threadIndex1D);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
/// \brief The index of the thread or work invocation.
@ -262,9 +255,6 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The indices of the incident elements.
///
/// A topology map has "visited" and "incident" elements (e.g. points, cells,
@ -305,7 +295,6 @@ private:
LogicalIndexType LogicalIndex;
IndicesIncidentType IndicesIncident;
CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};
// Specialization for permuted structured connectivity types.
@ -333,8 +322,7 @@ public:
vtkm::Id inputIndex,
vtkm::IdComponent visitIndex,
vtkm::Id outputIndex,
const PermutedConnectivityType& permutation,
vtkm::Id globalThreadIndexOffset = 0)
const PermutedConnectivityType& permutation)
{
this->ThreadIndex = threadIndex;
this->InputIndex = inputIndex;
@ -345,7 +333,6 @@ public:
this->LogicalIndex = permutation.Connectivity.FlatToLogicalToIndex(permutedIndex);
this->IndicesIncident = permutation.Connectivity.GetIndices(this->LogicalIndex);
this->CellShape = permutation.Connectivity.GetCellShape(permutedIndex);
this->GlobalThreadIndexOffset = globalThreadIndexOffset;
}
/// \brief The index of the thread or work invocation.
@ -399,9 +386,6 @@ public:
VTKM_EXEC
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
VTKM_EXEC
vtkm::Id GetGlobalIndex() const { return (this->GlobalThreadIndexOffset + this->OutputIndex); }
/// \brief The indices of the incident elements.
///
/// A topology map has "visited" and "incident" elements (e.g. points, cells,
@ -442,7 +426,6 @@ private:
LogicalIndexType LogicalIndex;
IndicesIncidentType IndicesIncident;
CellShapeTag CellShape;
vtkm::Id GlobalThreadIndexOffset;
};
}
}

@ -55,7 +55,7 @@ struct Fetch<FetchTag, vtkm::exec::arg::AspectTagWorkIndex, ThreadIndicesType, E
VTKM_EXEC
vtkm::Id Load(const ThreadIndicesType& indices, const ExecObjectType&) const
{
return indices.GetGlobalIndex();
return indices.GetThreadIndex();
}
VTKM_EXEC

@ -53,7 +53,7 @@ public:
vtkm::IdComponent GetVisitIndex() const { return this->VisitIndex; }
VTKM_EXEC_CONT
vtkm::Id GetGlobalIndex() const { return this->OutputIndex; }
vtkm::Id GetThreadIndex() const { return this->OutputIndex; }
private:
vtkm::Id InputIndex;

@ -102,7 +102,7 @@ struct FetchArrayDirectIn3DTests
for (vtkm::Id i = 0; i < ARRAY_SIZE[0]; i++, index1d++)
{
index3d[0] = i;
vtkm::exec::arg::ThreadIndicesBasic3D indices(index3d, index1d, index1d, 0, index1d, 0);
vtkm::exec::arg::ThreadIndicesBasic3D indices(index3d, index1d, index1d, 0, index1d);
T value = fetch.Load(indices, execObject);
VTKM_TEST_ASSERT(test_equal(value, TestValue(index1d, T())),
"Got invalid value from Load.");

@ -54,11 +54,10 @@ template <typename WType, typename IType>
class TaskStrided1D : public TaskStrided
{
public:
TaskStrided1D(const WType& worklet, const IType& invocation, vtkm::Id globalIndexOffset = 0)
TaskStrided1D(const WType& worklet, const IType& invocation)
: TaskStrided()
, Worklet(worklet)
, Invocation(invocation)
, GlobalIndexOffset(globalIndexOffset)
{
this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
//Bind the Worklet to void*
@ -78,8 +77,7 @@ public:
this->Invocation.OutputToInputMap,
this->Invocation.VisitArray,
this->Invocation.ThreadToOutputMap,
this->Invocation.GetInputDomain(),
this->GlobalIndexOffset));
this->Invocation.GetInputDomain()));
}
}
@ -90,7 +88,6 @@ private:
// hold by reference to reduce the number of copies, it is not possible
// currently.
const IType Invocation;
const vtkm::Id GlobalIndexOffset;
};
template <typename WType>
@ -123,11 +120,10 @@ template <typename WType, typename IType>
class TaskStrided3D : public TaskStrided
{
public:
TaskStrided3D(const WType& worklet, const IType& invocation, vtkm::Id globalIndexOffset = 0)
TaskStrided3D(const WType& worklet, const IType& invocation)
: TaskStrided()
, Worklet(worklet)
, Invocation(invocation)
, GlobalIndexOffset(globalIndexOffset)
{
this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
//Bind the Worklet to void*
@ -156,8 +152,7 @@ public:
this->Invocation.OutputToInputMap,
this->Invocation.VisitArray,
this->Invocation.ThreadToOutputMap,
this->Invocation.GetInputDomain(),
this->GlobalIndexOffset));
this->Invocation.GetInputDomain()));
}
}
@ -168,7 +163,6 @@ private:
// hold by reference to reduce the number of copies, it is not possible
// currently.
const IType Invocation;
const vtkm::Id GlobalIndexOffset;
};
template <typename WType>

@ -201,19 +201,17 @@ struct TestWorkletProxy : vtkm::exec::FunctorBase
typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const T& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
};
@ -229,19 +227,17 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const T& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
};

@ -36,12 +36,9 @@ class TaskSingular : public vtkm::exec::TaskBase
{
public:
VTKM_CONT
TaskSingular(const WorkletType& worklet,
const InvocationType& invocation,
vtkm::Id globalIndexOffset = 0)
TaskSingular(const WorkletType& worklet, const InvocationType& invocation)
: Worklet(worklet)
, Invocation(invocation)
, GlobalIndexOffset(globalIndexOffset)
{
}
@ -62,8 +59,7 @@ public:
this->Invocation.OutputToInputMap,
this->Invocation.VisitArray,
this->Invocation.ThreadToOutputMap,
this->Invocation.GetInputDomain(),
GlobalIndexOffset));
this->Invocation.GetInputDomain()));
}
private:
@ -73,7 +69,6 @@ private:
// hold by reference to reduce the number of copies, it is not possible
// currently.
const InvocationType Invocation;
const vtkm::Id GlobalIndexOffset;
};
}
}

@ -201,42 +201,35 @@ struct TestWorkletProxy : vtkm::exec::FunctorBase
template <typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutputArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const vtkm::Id& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutputArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
template <typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const vtkm::Id3& vtkmNotUsed(iterationSpace),
const vtkm::Id3& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id flatThreadIndex = vtkm::Dot(threadIndex, vtkm::Id3(1, 8, 64));
const vtkm::Id outIndex = threadToOut.Get(flatThreadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(flatThreadIndex,
outToIn.Get(outIndex),
visit.Get(outIndex),
outIndex,
globalThreadIndexOffset);
return vtkm::exec::arg::ThreadIndicesBasic(
flatThreadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
};
@ -251,42 +244,35 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
template <typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const vtkm::Id& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
template <typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutputArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const vtkm::Id3& vtkmNotUsed(iterationSpace),
const vtkm::Id3& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutputArrayType& threadToOutput,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id index = vtkm::Dot(threadIndex, vtkm::Id3(1, 8, 64));
const vtkm::Id outputIndex = threadToOutput.Get(index);
return vtkm::exec::arg::ThreadIndicesBasic(index,
outToIn.Get(outputIndex),
visit.Get(outputIndex),
outputIndex,
globalThreadIndexOffset);
return vtkm::exec::arg::ThreadIndicesBasic(
index, outToIn.Get(outputIndex), visit.Get(outputIndex), outputIndex);
}
};

@ -179,19 +179,17 @@ struct TestWorkletProxy : vtkm::exec::FunctorBase
typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const T& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
};
@ -207,19 +205,17 @@ struct TestWorkletErrorProxy : vtkm::exec::FunctorBase
typename OutToInArrayType,
typename VisitArrayType,
typename ThreadToOutArrayType,
typename InputDomainType,
typename G>
typename InputDomainType>
VTKM_EXEC vtkm::exec::arg::ThreadIndicesBasic GetThreadIndices(
const T& threadIndex,
const OutToInArrayType& outToIn,
const VisitArrayType& visit,
const ThreadToOutArrayType& threadToOut,
const InputDomainType&,
const G& globalThreadIndexOffset) const
const InputDomainType&) const
{
const vtkm::Id outIndex = threadToOut.Get(threadIndex);
return vtkm::exec::arg::ThreadIndicesBasic(
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex, globalThreadIndexOffset);
threadIndex, outToIn.Get(outIndex), visit.Get(outIndex), outIndex);
}
};

@ -36,11 +36,7 @@ VTKM_NEVER_EXPORT void TaskTilingSetErrorBuffer(
}
template <typename WType, typename IType>
VTKM_NEVER_EXPORT void TaskTiling1DExecute(void* w,
void* const v,
vtkm::Id globalIndexOffset,
vtkm::Id start,
vtkm::Id end)
VTKM_NEVER_EXPORT void TaskTiling1DExecute(void* w, void* const v, vtkm::Id start, vtkm::Id end)
{
using WorkletType = typename std::remove_cv<WType>::type;
using InvocationType = typename std::remove_cv<IType>::type;
@ -58,17 +54,12 @@ VTKM_NEVER_EXPORT void TaskTiling1DExecute(void* w,
invocation->OutputToInputMap,
invocation->VisitArray,
invocation->ThreadToOutputMap,
invocation->GetInputDomain(),
globalIndexOffset));
invocation->GetInputDomain()));
}
}
template <typename FType>
VTKM_NEVER_EXPORT void FunctorTiling1DExecute(void* f,
void* const,
vtkm::Id,
vtkm::Id start,
vtkm::Id end)
VTKM_NEVER_EXPORT void FunctorTiling1DExecute(void* f, void* const, vtkm::Id start, vtkm::Id end)
{
using FunctorType = typename std::remove_cv<FType>::type;
FunctorType const* const functor = static_cast<FunctorType*>(f);
@ -82,7 +73,6 @@ VTKM_NEVER_EXPORT void FunctorTiling1DExecute(void* f,
template <typename WType, typename IType>
VTKM_NEVER_EXPORT void TaskTiling3DExecute(void* w,
void* const v,
vtkm::Id globalIndexOffset,
const vtkm::Id3& maxSize,
vtkm::Id istart,
vtkm::Id iend,
@ -109,15 +99,13 @@ VTKM_NEVER_EXPORT void TaskTiling3DExecute(void* w,
invocation->OutputToInputMap,
invocation->VisitArray,
invocation->ThreadToOutputMap,
invocation->GetInputDomain(),
globalIndexOffset));
invocation->GetInputDomain()));
}
}
template <typename FType>
VTKM_NEVER_EXPORT void FunctorTiling3DExecute(void* f,
void* const,
vtkm::Id vtkmNotUsed(globalIndexOffset),
const vtkm::Id3& vtkmNotUsed(maxSize),
vtkm::Id istart,
vtkm::Id iend,
@ -148,7 +136,6 @@ public:
TaskTiling1D()
: Worklet(nullptr)
, Invocation(nullptr)
, GlobalIndexOffset(0)
{
}
@ -161,7 +148,6 @@ public:
, Invocation(nullptr)
, ExecuteFunction(nullptr)
, SetErrorBufferFunction(nullptr)
, GlobalIndexOffset(0)
{
//Setup the execute and set error buffer function pointers
this->ExecuteFunction = &FunctorTiling1DExecute<FunctorType>;
@ -174,12 +160,11 @@ public:
/// This constructor supports any vtkm worklet and the associated invocation
/// parameters that go along with it
template <typename WorkletType, typename InvocationType>
TaskTiling1D(WorkletType& worklet, InvocationType& invocation, vtkm::Id globalIndexOffset)
TaskTiling1D(WorkletType& worklet, InvocationType& invocation)
: Worklet(nullptr)
, Invocation(nullptr)
, ExecuteFunction(nullptr)
, SetErrorBufferFunction(nullptr)
, GlobalIndexOffset(globalIndexOffset)
{
//Setup the execute and set error buffer function pointers
this->ExecuteFunction = &TaskTiling1DExecute<WorkletType, InvocationType>;
@ -198,7 +183,6 @@ public:
, Invocation(task.Invocation)
, ExecuteFunction(task.ExecuteFunction)
, SetErrorBufferFunction(task.SetErrorBufferFunction)
, GlobalIndexOffset(task.GlobalIndexOffset)
{
}
@ -211,20 +195,18 @@ public:
void operator()(vtkm::Id start, vtkm::Id end) const
{
this->ExecuteFunction(this->Worklet, this->Invocation, this->GlobalIndexOffset, start, end);
this->ExecuteFunction(this->Worklet, this->Invocation, start, end);
}
protected:
void* Worklet;
void* Invocation;
using ExecuteSignature = void (*)(void*, void* const, vtkm::Id, vtkm::Id, vtkm::Id);
using ExecuteSignature = void (*)(void*, void* const, vtkm::Id, vtkm::Id);
ExecuteSignature ExecuteFunction;
using SetErrorBufferSignature = void (*)(void*, const vtkm::exec::internal::ErrorMessageBuffer&);
SetErrorBufferSignature SetErrorBufferFunction;
const vtkm::Id GlobalIndexOffset;
};
// TaskTiling3D represents an execution pattern for a worklet
@ -240,7 +222,6 @@ public:
TaskTiling3D()
: Worklet(nullptr)
, Invocation(nullptr)
, GlobalIndexOffset(0)
{
}
@ -253,7 +234,6 @@ public:
, Invocation(nullptr)
, ExecuteFunction(nullptr)
, SetErrorBufferFunction(nullptr)
, GlobalIndexOffset(0)
{
//Setup the execute and set error buffer function pointers
this->ExecuteFunction = &FunctorTiling3DExecute<FunctorType>;
@ -264,12 +244,11 @@ public:
}
template <typename WorkletType, typename InvocationType>
TaskTiling3D(WorkletType& worklet, InvocationType& invocation, vtkm::Id globalIndexOffset = 0)
TaskTiling3D(WorkletType& worklet, InvocationType& invocation)
: Worklet(nullptr)
, Invocation(nullptr)
, ExecuteFunction(nullptr)
, SetErrorBufferFunction(nullptr)
, GlobalIndexOffset(globalIndexOffset)
{
// Setup the execute and set error buffer function pointers
this->ExecuteFunction = &TaskTiling3DExecute<WorkletType, InvocationType>;
@ -288,7 +267,6 @@ public:
, Invocation(task.Invocation)
, ExecuteFunction(task.ExecuteFunction)
, SetErrorBufferFunction(task.SetErrorBufferFunction)
, GlobalIndexOffset(task.GlobalIndexOffset)
{
}
@ -305,28 +283,19 @@ public:
vtkm::Id j,
vtkm::Id k) const
{
this->ExecuteFunction(
this->Worklet, this->Invocation, this->GlobalIndexOffset, maxSize, istart, iend, j, k);
this->ExecuteFunction(this->Worklet, this->Invocation, maxSize, istart, iend, j, k);
}
protected:
void* Worklet;
void* Invocation;
using ExecuteSignature = void (*)(void*,
void* const,
vtkm::Id,
const vtkm::Id3&,
vtkm::Id,
vtkm::Id,
vtkm::Id,
vtkm::Id);
using ExecuteSignature =
void (*)(void*, void* const, const vtkm::Id3&, vtkm::Id, vtkm::Id, vtkm::Id, vtkm::Id);
ExecuteSignature ExecuteFunction;
using SetErrorBufferSignature = void (*)(void*, const vtkm::exec::internal::ErrorMessageBuffer&);
SetErrorBufferSignature SetErrorBufferFunction;
const vtkm::Id GlobalIndexOffset;
};
}
}

@ -147,8 +147,13 @@ set(sources_device
ClipWithField.cxx
ClipWithImplicitFunction.cxx
Contour.cxx
ContourInteger.cxx
ContourScalar.cxx
ExternalFaces.cxx
ExtractStructured.cxx
GradientScalar.cxx
GradientUniformPoints.cxx
GradientVector.cxx
PointAverage.cxx
Threshold.cxx
VectorMagnitude.cxx

@ -67,8 +67,5 @@ VTKM_FILTER_EXPORT vtkm::Float64 Contour::GetIsoValue(vtkm::Id index) const
{
return this->IsoValues[static_cast<std::size_t>(index)];
}
//-----------------------------------------------------------------------------
VTKM_FILTER_INSTANTIATE_EXECUTE_METHOD(Contour);
}
}

@ -150,8 +150,56 @@ private:
vtkm::worklet::Contour Worklet;
};
#ifndef vtkm_filter_Contour_cxx
VTKM_FILTER_EXPORT_EXECUTE_METHOD(Contour);
#ifndef vtkm_filter_ContourExecute_cxx
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::UInt8>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::UInt8, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int8>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int8, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
#endif
}
} // namespace vtkm::filter

@ -97,8 +97,7 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
: !this->ComputeFastNormalsForUnstructured;
if (this->GenerateNormals && generateHighQualityNormals)
{
outputCells = this->Worklet.Run(&ivalues[0],
static_cast<vtkm::Id>(ivalues.size()),
outputCells = this->Worklet.Run(ivalues,
vtkm::filter::ApplyPolicyCellSet(cells, policy),
coords.GetData(),
field,
@ -107,12 +106,8 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
}
else
{
outputCells = this->Worklet.Run(&ivalues[0],
static_cast<vtkm::Id>(ivalues.size()),
vtkm::filter::ApplyPolicyCellSet(cells, policy),
coords.GetData(),
field,
vertices);
outputCells = this->Worklet.Run(
ivalues, vtkm::filter::ApplyPolicyCellSet(cells, policy), coords.GetData(), field, vertices);
}
if (this->GenerateNormals)

@ -0,0 +1,46 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_filter_ContourExecute_cxx
#define vtk_m_filter_ContourExecute_cxx
#include <vtkm/filter/Contour.h>
namespace vtkm
{
namespace filter
{
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::UInt8>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::UInt8, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int8>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int8, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
}
}
#endif

@ -0,0 +1,46 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_filter_ContourExecute_cxx
#define vtk_m_filter_ContourExecute_cxx
#include <vtkm/filter/Contour.h>
namespace vtkm
{
namespace filter
{
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
}
}
#endif

@ -22,8 +22,8 @@ namespace filter
class CrossProduct : public vtkm::filter::FilterField<CrossProduct>
{
public:
//currently the DotProduct filter only works on vector data.
using SupportedTypes = TypeListVecCommon;
//CrossProduct filter only works on vec3 data.
using SupportedTypes = vtkm::TypeListFieldVec3;
VTKM_CONT
CrossProduct();

@ -22,9 +22,6 @@ namespace filter
class DotProduct : public vtkm::filter::FilterField<DotProduct>
{
public:
//currently the DotProduct filter only works on vector data.
using SupportedTypes = TypeListVecCommon;
VTKM_CONT
DotProduct();
@ -123,11 +120,10 @@ public:
//@}
template <typename T, typename StorageType, typename DerivedPolicy>
VTKM_CONT vtkm::cont::DataSet DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
vtkm::filter::PolicyBase<DerivedPolicy> policy);
private:
std::string SecondaryFieldName;

@ -33,7 +33,7 @@ inline VTKM_CONT DotProduct::DotProduct()
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet DotProduct::DoExecute(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, StorageType>& primary,
const vtkm::cont::ArrayHandle<T, StorageType>& primary,
const vtkm::filter::FieldMetadata& fieldMetadata,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
@ -46,10 +46,9 @@ inline VTKM_CONT vtkm::cont::DataSet DotProduct::DoExecute(
{
secondaryField = inDataSet.GetField(this->SecondaryFieldName, this->SecondaryFieldAssociation);
}
auto secondary =
vtkm::filter::ApplyPolicyFieldOfType<vtkm::Vec<T, 3>>(secondaryField, policy, *this);
auto secondary = vtkm::filter::ApplyPolicyFieldOfType<T>(secondaryField, policy, *this);
vtkm::cont::ArrayHandle<T> output;
vtkm::cont::ArrayHandle<typename vtkm::VecTraits<T>::ComponentType> output;
this->Invoke(vtkm::worklet::DotProduct{}, primary, secondary, output);
return CreateResult(inDataSet, output, this->GetOutputFieldName(), fieldMetadata);

@ -11,6 +11,8 @@
#ifndef vtk_m_filter_Gradient_h
#define vtk_m_filter_Gradient_h
#include <vtkm/filter/vtkm_filter_export.h>
#include <vtkm/filter/FilterCell.h>
namespace vtkm
@ -91,7 +93,7 @@ public:
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
vtkm::filter::PolicyBase<DerivedPolicy> policy);
private:
bool ComputePointGradient = false;
@ -106,6 +108,64 @@ private:
std::string QCriterionName = "QCriterion";
std::string VorticityName = "Vorticity";
};
#ifndef vtkm_filter_Gradient_cxx
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
extern template VTKM_FILTER_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
#endif
}
} // namespace vtkm::filter

@ -45,13 +45,26 @@ inline vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& inField,
const vtkm::filter::FieldMetadata& fieldMetadata,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
if (!fieldMetadata.IsPointField())
{
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
constexpr bool isVector = std::is_same<typename vtkm::VecTraits<T>::HasMultipleComponents,
vtkm::VecTraitsTagMultipleComponents>::value;
if (GetComputeQCriterion() && !isVector)
{
throw vtkm::cont::ErrorFilterExecution("scalar gradients can't generate qcriterion");
}
if (GetComputeVorticity() && !isVector)
{
throw vtkm::cont::ErrorFilterExecution("scalar gradients can't generate vorticity");
}
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -86,9 +99,6 @@ inline vtkm::cont::DataSet Gradient::DoExecute(
transpose_3x3(outArray);
}
constexpr bool isVector = std::is_same<typename vtkm::VecTraits<T>::HasMultipleComponents,
vtkm::VecTraitsTagMultipleComponents>::value;
vtkm::cont::Field::Association fieldAssociation(this->ComputePointGradient
? vtkm::cont::Field::Association::POINTS
: vtkm::cont::Field::Association::CELL_SET);

@ -0,0 +1,46 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_filter_Gradient_cxx
#define vtk_m_filter_Gradient_cxx
#include <vtkm/filter/Gradient.h>
namespace vtkm
{
namespace filter
{
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
}
}
#endif

@ -0,0 +1,28 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_filter_Gradient_cxx
#define vtk_m_filter_Gradient_cxx
#include <vtkm/filter/Gradient.h>
namespace vtkm
{
namespace filter
{
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
}
}
#endif

@ -0,0 +1,46 @@
//============================================================================
// 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.
//============================================================================
#ifndef vtk_m_filter_Gradient_cxx
#define vtk_m_filter_Gradient_cxx
#include <vtkm/filter/Gradient.h>
namespace vtkm
{
namespace filter
{
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_32>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_32, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_64>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
template VTKM_FILTER_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Vec3f_64, vtkm::cont::StorageTagVirtual>&,
const vtkm::filter::FieldMetadata&,
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
}
}
#endif

@ -16,6 +16,7 @@
#include <vtkm/cont/CellSetList.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DataSet.h>
#include <vtkm/cont/DefaultTypes.h>
#include <vtkm/cont/DeviceAdapterList.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/Field.h>
@ -32,19 +33,10 @@ template <typename Derived>
struct PolicyBase
{
using FieldTypeList = VTKM_DEFAULT_TYPE_LIST;
using StorageList = vtkm::ListAppend<
VTKM_DEFAULT_STORAGE_LIST,
vtkm::List<
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32>,
vtkm::cont::ArrayHandle<vtkm::Float32>>::StorageTag,
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64>,
vtkm::cont::ArrayHandle<vtkm::Float64>>::StorageTag>>;
using StorageList = VTKM_DEFAULT_STORAGE_LIST;
using StructuredCellSetList = vtkm::cont::CellSetListStructured;
using UnstructuredCellSetList = vtkm::cont::CellSetListUnstructured;
using StructuredCellSetList = VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED;
using UnstructuredCellSetList = VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED;
using AllCellSetList = VTKM_DEFAULT_CELL_SET_LIST;
};

@ -16,6 +16,8 @@ set(unit_tests
UnitTestClipWithFieldFilter.cxx
UnitTestClipWithImplicitFunctionFilter.cxx
UnitTestContourFilter.cxx
UnitTestContourFilterCustomPolicy.cxx
UnitTestContourFilterNormals.cxx
UnitTestContourTreeUniformFilter.cxx
UnitTestContourTreeUniformAugmentedFilter.cxx
UnitTestCoordinateSystemTransform.cxx
@ -29,7 +31,8 @@ set(unit_tests
UnitTestFieldMetadata.cxx
UnitTestFieldSelection.cxx
UnitTestFieldToColors.cxx
UnitTestGradient.cxx
UnitTestGradientExplicit.cxx
UnitTestGradientUniform.cxx
UnitTestGhostCellClassify.cxx
UnitTestGhostCellRemove.cxx
UnitTestHistogramFilter.cxx

Some files were not shown because too many files have changed in this diff Show More