Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

.ubuntu2204_cuda122_kokkos: &ubuntu2204_cuda122_kokkos
image:
name: "ghcr.io/viskores/viskores:ci-ubuntu2204_kokkos_cuda-20250320"
name: "ghcr.io/viskores/viskores:ci-ubuntu2204_kokkos_cuda-20251111"
extends:
- .docker_image

Expand Down
13 changes: 6 additions & 7 deletions .gitlab/ci/docker/ubuntu2204_kokkos_cuda.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,24 @@ RUN mkdir /opt/cmake/ && \
ENV PATH "/opt/cmake/bin:${PATH}"

# Build and install Kokkos
ARG KOKKOS_VERSION=3.7.02
ARG KOKKOS_VERSION=4.1.00
RUN mkdir -p /opt/kokkos/build && \
cd /opt/kokkos/build && \
curl -L https://github.com/kokkos/kokkos/archive/refs/tags/$KOKKOS_VERSION.tar.gz > kokkos-$KOKKOS_VERSION.tar.gz && \
tar -xf kokkos-$KOKKOS_VERSION.tar.gz && \
mkdir bld && cd bld && \
CXX=/opt/kokkos/build/kokkos-$KOKKOS_VERSION/bin/nvcc_wrapper \
cmake -B . -S ../kokkos-$KOKKOS_VERSION \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/kokkos \
-DCMAKE_CXX_FLAGS=-fPIC \
-DCMAKE_CXX_STANDARD=14 \
-DKokkos_ENABLE_CUDA=ON \
-DCMAKE_INSTALL_PREFIX=/opt/kokkos \
-DKokkos_ARCH_AMPERE80=ON \
-DKokkos_ENABLE_CUDA_CONSTEXPR=ON \
-DKokkos_ENABLE_CUDA_LAMBDA=ON \
-DKokkos_ENABLE_CUDA_LDG_INTRINSIC=ON \
-DKokkos_ENABLE_CUDA=ON \
-DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=OFF \
-DKokkos_ENABLE_CUDA_UVM=ON \
-DKokkos_ARCH_AMPERE80=ON && \
&& \
cmake --build . -j 8 && \
cmake --install . && \
cd ..; rm -rf kokkos-$KOKKOS_VERSION.tar.gz kokkos-$KOKKOS_VERSION bld
2 changes: 1 addition & 1 deletion .gitlab/ci/ubuntu2204.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ ubuntu2204_clang12:
CMAKE_BUILD_TYPE: Debug
VISKORES_SETTINGS: "tbb+shared+examples+ccache"

ubuntu2204_kokkos37_cuda122:
ubuntu2204_cuda122_kokkos41:
tags:
- nvidia-a100
- uo-gpu
Expand Down
24 changes: 19 additions & 5 deletions CMake/ViskoresWrappers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -438,17 +438,31 @@ function(viskores_add_target_information uses_viskores_target)
endif()
endforeach()

foreach(target IN LISTS targets)
target_compile_definitions(${target} PRIVATE VISKORES_IS_VISKORES_TARGET)
endforeach()

if(Viskores_TI_DROP_UNUSED_SYMBOLS)
foreach(target IN LISTS targets)
viskores_add_drop_unused_function_flags(${target})
endforeach()
endif()

if(TARGET viskores_cuda OR TARGET viskores::cuda OR TARGET viskores_kokkos_cuda OR TARGET viskores::kokkos_cuda)
set_source_files_properties(${Viskores_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
elseif(TARGET viskores_kokkos_hip OR TARGET viskores::kokkos_hip)
set_source_files_properties(${Viskores_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP")
kokkos_compilation(SOURCE ${Viskores_TI_DEVICE_SOURCES})
if(Viskores_TI_DEVICE_SOURCES)
foreach(target IN LISTS targets)
target_link_libraries(${target}
PRIVATE $<TARGET_NAME_IF_EXISTS:viskores_exec> $<TARGET_NAME_IF_EXISTS:viskores::viskores_exec>)
endforeach()

set_property(SOURCE ${Viskores_TI_DEVICE_SOURCES}
APPEND PROPERTY COMPILE_DEFINITIONS VISKORES_IS_DEVICE_SOURCE)

if(TARGET viskores_cuda OR TARGET viskores::cuda OR TARGET viskores_kokkos_cuda OR TARGET viskores::kokkos_cuda)
set_source_files_properties(${Viskores_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "CUDA")
elseif(TARGET viskores_kokkos_hip OR TARGET viskores::kokkos_hip)
set_source_files_properties(${Viskores_TI_DEVICE_SOURCES} PROPERTIES LANGUAGE "HIP")
kokkos_compilation(SOURCE ${Viskores_TI_DEVICE_SOURCES})
endif()
endif()
endfunction()

Expand Down
4 changes: 2 additions & 2 deletions CMake/testing/ViskoresTestInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function(viskores_test_against_install_cmake dir)

set_tests_properties(${build_name} PROPERTIES LABELS ${test_label} )
set_tests_properties(${build_name} PROPERTIES FIXTURES_REQUIRED viskores_installed)
set_tests_properties(${build_name} PROPERTIES TIMEOUT 600)
set_tests_properties(${build_name} PROPERTIES TIMEOUT 60)
endfunction()

# -----------------------------------------------------------------------------
Expand All @@ -190,7 +190,7 @@ function(_test_install_make dir name)
set_tests_properties(${build_name} PROPERTIES ENVIRONMENT "${ARGN}")
set_tests_properties(${build_name} PROPERTIES LABELS "TEST_INSTALL")
set_tests_properties(${build_name} PROPERTIES FIXTURES_REQUIRED "viskores_installed;makefile_setup")
set_tests_properties(${build_name} PROPERTIES TIMEOUT 600)
set_tests_properties(${build_name} PROPERTIES TIMEOUT 60)
endfunction()

# -----------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ GROUPS
FiltersCommon
Filters
DEPENDS
viskores_worklet
viskores_filter_core
viskores_filter_clean_grid
PRIVATE_DEPENDS
viskores_worklet
TEST_DEPENDS
viskores_filter_clean_grid
viskores_filter_entity_extraction
Expand Down
14 changes: 14 additions & 0 deletions docs/changelog/check-kokkos-finalize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Added check for Kokkos finalize

Previously, if Viskores initialized Kokkos, it would always fall the Kokkos
finalize routine. This assumed that all other Kokkos users would follow the same
pattern of checking before initializing Kokkos and finalizing if and only if
Viskores initialized.

However, a more aggressive library may always finalize on shutdown if it detects
Kokkos was ever initialized. To play well with such libraries, Viskores now also
checks to make sure that Kokkos has not yet been finalized.

This cannot guarantee that another library may finalize Kokkos after Viskores,
but it will work with any libraries that either only finalize if they do the
initialization or check before initializing or finalizing.
7 changes: 7 additions & 0 deletions docs/changelog/device-lib-private.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Made the device library private

Viskores no longer makes the device libraries public on its exported
`viskores::cont` target. Previously, the device libraries were linked to
`viskores::cont` as `PUBLIC`, which means that pretty much anything that used
Viskores also brought in any compiler flags for the device. This sometimes
forced downstream code to use a device compiler when it did not need to.
1 change: 1 addition & 0 deletions docs/users-guide/viskores.module
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ TEST_DEPENDS
viskores_filter_geometry_refinement
viskores_filter_mesh_info
viskores_rendering
viskores_worklet
4 changes: 2 additions & 2 deletions examples/contour_tree_augmented/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ endif()
# Serial
####################################
add_executable(ContourTree_Augmented ContourTreeApp.cxx)
target_link_libraries(ContourTree_Augmented viskores::filter_scalar_topology viskores::io)
target_link_libraries(ContourTree_Augmented PUBLIC viskores::filter_scalar_topology viskores::io viskores::worklet)
viskores_add_target_information(ContourTree_Augmented
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES ContourTreeApp.cxx)
Expand All @@ -92,7 +92,7 @@ endif()
####################################
if (Viskores_ENABLE_MPI)
add_executable(ContourTree_Augmented_MPI ContourTreeApp.cxx)
target_link_libraries(ContourTree_Augmented_MPI viskores::filter_scalar_topology viskores::io MPI::MPI_CXX)
target_link_libraries(ContourTree_Augmented_MPI viskores::filter_scalar_topology viskores::io viskores::worklet MPI::MPI_CXX)
viskores_add_target_information(ContourTree_Augmented_MPI
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ContourTreeApp.cxx)
Expand Down
4 changes: 2 additions & 2 deletions examples/cosmotools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ find_package(Viskores REQUIRED QUIET)

add_executable(CosmoCenterFinder CosmoCenterFinder.cxx)
add_executable(CosmoHaloFinder CosmoHaloFinder.cxx)
target_link_libraries(CosmoCenterFinder PRIVATE viskores::filter_core)
target_link_libraries(CosmoHaloFinder PRIVATE viskores::filter_core)
target_link_libraries(CosmoCenterFinder PRIVATE viskores::filter_core viskores::worklet)
target_link_libraries(CosmoHaloFinder PRIVATE viskores::filter_core viskores::worklet)

viskores_add_target_information(CosmoCenterFinder CosmoHaloFinder
DROP_UNUSED_SYMBOLS
Expand Down
3 changes: 2 additions & 1 deletion examples/hello_worklet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ find_package(Viskores REQUIRED QUIET)

if(TARGET viskores::io)
add_executable(HelloWorklet HelloWorklet.cxx)
target_link_libraries(HelloWorklet PRIVATE viskores::filter_core viskores::io)
target_link_libraries(HelloWorklet
PRIVATE viskores::filter_core viskores::worklet viskores::io)

viskores_add_target_information(HelloWorklet
DROP_UNUSED_SYMBOLS
Expand Down
2 changes: 1 addition & 1 deletion examples/logistic_map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ find_package(Viskores REQUIRED QUIET)

if(TARGET viskores::io)
add_executable(LogisticMap LogisticMap.cxx)
target_link_libraries(LogisticMap PRIVATE viskores::io)
target_link_libraries(LogisticMap PRIVATE viskores::io viskores::worklet)

viskores_add_target_information(LogisticMap
DROP_UNUSED_SYMBOLS
Expand Down
2 changes: 1 addition & 1 deletion examples/multi_backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(srcs

if(TARGET viskores::filter_vector_analysis)
add_executable(MultiBackend ${srcs} ${headers})
target_link_libraries(MultiBackend PRIVATE viskores::filter_vector_analysis Threads::Threads)
target_link_libraries(MultiBackend PRIVATE viskores::filter_vector_analysis viskores::worklet Threads::Threads)
viskores_add_target_information(MultiBackend
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS
Expand Down
13 changes: 2 additions & 11 deletions examples/polyline_archimedean_helix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@ project(PolyLineArchimedeanHelix CXX)

find_package(Viskores REQUIRED QUIET)

if (TARGET viskores::rendering)
# TODO: This example should be changed from using the Tube worklet to using
# the Tube filter (in the viskores::filter_geometry_refinement library). Then
# compiling it would no longer require a device compiler and the example
# would generally be simpler.
if (TARGET viskores::rendering AND TARGET viskores::filter_geometry_refinement)
add_executable(PolyLineArchimedeanHelix PolyLineArchimedeanHelix.cxx)
target_link_libraries(PolyLineArchimedeanHelix PRIVATE viskores::rendering)
viskores_add_target_information(PolyLineArchimedeanHelix
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS
DEVICE_SOURCES PolyLineArchimedeanHelix.cxx
)
target_link_libraries(PolyLineArchimedeanHelix PRIVATE viskores::rendering viskores::filter_geometry_refinement)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <complex>
#include <viskores/cont/DataSetBuilderExplicit.h>
#include <viskores/filter/geometry_refinement/worklet/Tube.h>
#include <viskores/filter/geometry_refinement/Tube.h>
#include <viskores/io/VTKDataSetWriter.h>

#include <viskores/cont/ColorTable.h>
Expand Down Expand Up @@ -66,25 +66,11 @@ void TubeThatSpiral(viskores::FloatDefault radius,

viskores::cont::DataSet ds = dsb.Create();

viskores::worklet::Tube tubeWorklet(
/*capEnds = */ true,
/* how smooth the cylinder is; infinitely smooth as n->infty */ numSides,
radius);

// You added lines, but you need to extend it to a tube.
// This generates a new pointset, and new cell set.
viskores::cont::ArrayHandle<viskores::Vec3f> tubePoints;
viskores::cont::CellSetSingleType<> tubeCells;
tubeWorklet.Run(ds.GetCoordinateSystem()
.GetData()
.AsArrayHandle<viskores::cont::ArrayHandle<viskores::Vec3f>>(),
ds.GetCellSet(),
tubePoints,
tubeCells);

viskores::cont::DataSet tubeDataset;
tubeDataset.AddCoordinateSystem(viskores::cont::CoordinateSystem("coords", tubePoints));
tubeDataset.SetCellSet(tubeCells);
viskores::filter::geometry_refinement::Tube tubeFilter;
tubeFilter.SetCapping(true);
tubeFilter.SetNumberOfSides(numSides);
tubeFilter.SetRadius(radius);
viskores::cont::DataSet tubeDataset = tubeFilter.Execute(ds);

viskores::Bounds coordsBounds = tubeDataset.GetCoordinateSystem().GetBounds();

Expand All @@ -110,7 +96,7 @@ void TubeThatSpiral(viskores::FloatDefault radius,
viskores::rendering::Color bg(0.2f, 0.2f, 0.2f, 1.0f);


std::vector<viskores::FloatDefault> v(static_cast<std::size_t>(tubePoints.GetNumberOfValues()));
std::vector<viskores::FloatDefault> v(static_cast<std::size_t>(tubeDataset.GetNumberOfPoints()));
// The first value is a cap:
v[0] = 0;
for (viskores::Id i = 1; i < viskores::Id(v.size()); i += numSides)
Expand Down
2 changes: 1 addition & 1 deletion examples/redistribute_points/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ find_package(Viskores REQUIRED QUIET)

if(TARGET viskores::io AND TARGET viskores::filter_entity_extraction)
add_executable(RedistributePoints RedistributePoints.cxx RedistributePoints.h main.cxx)
target_link_libraries(RedistributePoints PRIVATE viskores::io viskores::filter_entity_extraction)
target_link_libraries(RedistributePoints PRIVATE viskores::io viskores::filter_entity_extraction viskores::worklet)
viskores_add_target_information(RedistributePoints
DROP_UNUSED_SYMBOLS
MODIFY_CUDA_FLAGS
Expand Down
20 changes: 10 additions & 10 deletions tutorial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ if (Viskores_ENABLE_TUTORIALS)
endif()

add_executable(io io.cxx)
target_link_libraries(io viskores::io)
target_link_libraries(io PRIVATE viskores::io)

add_executable(contour contour.cxx)
target_link_libraries(contour viskores::filter_core viskores::filter_contour viskores::io)
target_link_libraries(contour PRIVATE viskores::filter_core viskores::filter_contour viskores::io)

add_executable(contour_two_fields contour_two_fields.cxx)
target_link_libraries(contour_two_fields viskores::filter_core viskores::filter_contour viskores::io)
target_link_libraries(contour_two_fields PRIVATE viskores::filter_core viskores::filter_contour viskores::io)

add_executable(two_filters two_filters.cxx)
target_link_libraries(two_filters viskores::filter_core viskores::filter_contour viskores::io)
target_link_libraries(two_filters PRIVATE viskores::filter_core viskores::filter_contour viskores::io)

add_executable(mag_grad mag_grad.cxx)
target_link_libraries(mag_grad viskores::filter_core viskores::filter_vector_analysis viskores::io)
target_link_libraries(mag_grad PRIVATE viskores::filter_core viskores::filter_vector_analysis viskores::io viskores::worklet)
# Because mag_grad.cxx creates a worklet with code that
# runs on a GPU, it needs additional information.
viskores_add_target_information(mag_grad
Expand All @@ -72,23 +72,23 @@ viskores_add_target_information(mag_grad

if (Viskores_ENABLE_RENDERING)
add_executable(rendering rendering.cxx)
target_link_libraries(rendering viskores::io viskores::rendering)
target_link_libraries(rendering PRIVATE viskores::io viskores::rendering)
endif ()

add_executable(error_handling error_handling.cxx)
target_link_libraries(error_handling viskores::filter_core viskores::filter_contour viskores::io)
target_link_libraries(error_handling PRIVATE viskores::filter_core viskores::filter_contour viskores::io)

add_executable(logging logging.cxx)
target_link_libraries(logging viskores::io)
target_link_libraries(logging PRIVATE viskores::io)

add_executable(point_to_cell point_to_cell.cxx)
target_link_libraries(point_to_cell viskores::worklet viskores::filter_core viskores::io)
target_link_libraries(point_to_cell PRIVATE viskores::worklet viskores::filter_core viskores::io)
viskores_add_target_information(point_to_cell
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES point_to_cell.cxx)

add_executable(extract_edges extract_edges.cxx)
target_link_libraries(extract_edges viskores::cont viskores::filter_core viskores::filter_contour viskores::worklet viskores::io)
target_link_libraries(extract_edges PRIVATE viskores::cont viskores::filter_core viskores::filter_contour viskores::worklet viskores::io)
viskores_add_target_information(extract_edges
DROP_UNUSED_SYMBOLS MODIFY_CUDA_FLAGS
DEVICE_SOURCES extract_edges.cxx)
Expand Down
2 changes: 1 addition & 1 deletion viskores/cont/AtomicArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <viskores/List.h>
#include <viskores/StaticAssert.h>
#include <viskores/cont/ArrayHandle.h>
#include <viskores/cont/DeviceAdapter.h>
#include <viskores/cont/DeviceAdapterTag.h>
#include <viskores/cont/ExecutionObjectBase.h>
#include <viskores/exec/AtomicArrayExecutionObject.h>

Expand Down
16 changes: 1 addition & 15 deletions viskores/cont/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,5 @@ target_sources(viskores_cont
add_subdirectory(internal)
add_subdirectory(arg)

set(backends )
if(TARGET viskores_tbb)
list(APPEND backends viskores_tbb)
endif()
if(TARGET viskores_cuda)
list(APPEND backends viskores_cuda)
endif()
if(TARGET viskores_openmp)
list(APPEND backends viskores_openmp)
endif()
if(TARGET viskores_kokkos)
list(APPEND backends viskores_kokkos)
endif()

target_link_libraries(viskores_cont PUBLIC viskores_compiler_flags ${backends})
target_link_libraries(viskores_cont PUBLIC viskores_compiler_flags)
target_link_libraries(viskores_cont PUBLIC Threads::Threads)
1 change: 0 additions & 1 deletion viskores/cont/DataSetBuilderRectilinear.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <viskores/cont/ArrayPortalToIterators.h>
#include <viskores/cont/CoordinateSystem.h>
#include <viskores/cont/DataSet.h>
#include <viskores/cont/serial/DeviceAdapterSerial.h>

namespace viskores
{
Expand Down
9 changes: 9 additions & 0 deletions viskores/cont/DeviceAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
// order in which the sub-files are loaded. (But the compile should still
// succeed if the order is changed.) Turn off formatting to keep the order.

#if defined(VISKORES_IS_VISKORES_TARGET) && !defined(VISKORES_NO_ERROR_ON_MIXED_CUDA_CXX_TAG)
#ifndef VISKORES_IS_DEVICE_SOURCE
#error Source file is including device code but not marked as a device source.
#endif
#ifndef VISKORES_DEVICE_LINKED
#error Including device code without linking device libraries.
#endif
#endif

// clang-format off
#include <viskores/cont/cuda/DeviceAdapterCuda.h>
#include <viskores/cont/kokkos/DeviceAdapterKokkos.h>
Expand Down
Loading