Skip to content

Commit

Permalink
Always build demo rasterizer
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Feb 5, 2024
1 parent 4dd584f commit 444175a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
4 changes: 1 addition & 3 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ add_subdirectory(celer-g4)
if(CELERITAS_BUILD_DEMOS)
add_subdirectory(demo-interactor)
add_subdirectory(demo-geo-check)
if(CELERITAS_USE_CUDA)
add_subdirectory(demo-rasterizer)
endif()
add_subdirectory(demo-rasterizer)
endif()

#-----------------------------------------------------------------------------#
Expand Down
32 changes: 20 additions & 12 deletions app/demo-rasterizer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#-----------------------------------------------------------------------------#

add_executable(demo-rasterizer
set(SOURCES
demo-rasterizer.cc
RDemoRunner.cc
RDemoKernel.cu
ImageIO.cc
ImageStore.cc
)
if(CELERITAS_USE_HIP)
set_source_files_properties(
if(CELERITAS_USE_CUDA OR CELERITAS_USE_HIP)
list(APPEND SOURCES
RDemoKernel.cu
PROPERTIES LANGUAGE HIP
)
if(CELERITAS_USE_HIP)
set_source_files_properties(
RDemoKernel.cu
PROPERTIES LANGUAGE HIP
)
endif()
endif()

set(_rasterizer_libs
Expand All @@ -25,6 +29,8 @@ set(_rasterizer_libs
if(CELERITAS_CORE_GEO STREQUAL "VecGeom")
list(APPEND _rasterizer_libs VecGeom::vecgeom)
endif()

add_executable(demo-rasterizer ${SOURCES})
celeritas_target_link_libraries(demo-rasterizer ${_rasterizer_libs})

#-----------------------------------------------------------------------------#
Expand All @@ -40,6 +46,14 @@ set(_gdml_inp "${CELER_APP_DATA_DIR}/two-boxes.gdml")
add_test(NAME "app/demo-rasterizer"
COMMAND "$<TARGET_FILE:Python::Interpreter>" "${_driver}" "${_gdml_inp}"
)

if((CELERITAS_CORE_GEO STREQUAL "ORANGE") OR CELER_DISABLE_DEVICE)
# two-boxes.org.json isn't set up in the test directory
# or device is unavailable
set(_maybe_disable DISABLED true)
else()
set(_maybe_disable)
endif()
set(_env
"CELERITAS_DEMO_EXE=$<TARGET_FILE:demo-rasterizer>"
"CELER_DISABLE_PARALLEL=1"
Expand All @@ -49,13 +63,7 @@ set_tests_properties("app/demo-rasterizer" PROPERTIES
RESOURCE_LOCK gpu
REQUIRED_FILES "${_driver};${_gdml_inp}"
LABELS "app;nomemcheck;gpu"
${_maybe_disable}
)
if(CELERITAS_CORE_GEO STREQUAL "ORANGE" OR CELER_DISABLE_DEVICE)
# two-boxes.org.json isn't set up in the test directory
# or device is unavailable
set_tests_properties("app/demo-rasterizer" PROPERTIES
DISABLED true
)
endif()

#-----------------------------------------------------------------------------#
10 changes: 10 additions & 0 deletions app/demo-rasterizer/RDemoKernel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//---------------------------------------------------------------------------//
#pragma once

#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "celeritas/geo/GeoData.hh"

#include "ImageData.hh"
Expand All @@ -24,6 +26,14 @@ void trace(GeoParamsCRefDevice const& geo_params,
GeoStateRefDevice const& geo_state,
ImageData const& image);

#if !CELER_USE_DEVICE
inline void
trace(GeoParamsCRefDevice const&, GeoStateRefDevice const&, ImageData const&)
{
CELER_NOT_CONFIGURED("CUDA or HIP");
}
#endif

//---------------------------------------------------------------------------//
} // namespace app
} // namespace celeritas

0 comments on commit 444175a

Please sign in to comment.