Skip to content
Open
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
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "Extern/googletest"]
path = Extern/googletest
url = https://github.com/google/googletest
[submodule "Extern/VMA"]
path = Extern/VMA
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
[submodule "Extern/imgui"]
path = Extern/imgui
url = https://github.com/ocornut/imgui
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ option(RAYX_ENABLE_OPENMP "This option enables the search for OPENMP. Project wi
option(RAYX_REQUIRE_OPENMP "If option 'RAYX_ENABLE_OPENMP' is ON, this option will add the requirement that openmp must be found." OFF)
option(RAYX_ENABLE_H5 "This option enables the search for HDF5. Project will be compiled without HDF5 if not found." ON)
option(RAYX_REQUIRE_H5 "If option 'RAYX_ENABLE_H5' is ON, this option will add the requirement that HDF5 must be found." OFF)
option(RAYX_BUILD_RAYX_CLI "This option builds the RAYX command line interface." ON)
option(RAYX_BUILD_RAYX_UI "This option builds the RAYX graphical user interface." ON)
option(RAYX_BUILD_RAYX_TESTS "This option builds the RAYX test suite." ON)
option(RAYX_STATIC_LIB "This option builds 'rayx-core' as a static library." OFF)
# ------------------

Expand Down
50 changes: 28 additions & 22 deletions Extern/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
include(CheckLanguage)

set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)

add_subdirectory(googletest)

# support version in CMakeLists.txt of portable-file-dialogs was removed from cmake. thus we include the header only library by hand
add_library(portable_file_dialogs INTERFACE)
target_include_directories(portable_file_dialogs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/portable-file-dialogs)

# --- CLI11 ---
set(CLI11_SANITIZERS OFF)
set(CLI11_BUILD_DOCS OFF)
set(CLI11_BUILD_TESTS OFF)
set(CLI11_BUILD_EXAMPLES OFF)
set(CLI11_BUILD_EXAMPLES_JSON OFF)
set(CLI11_SINGLE_FILE_TESTS OFF)
set(CLI11_INSTALL OFF)
set(CLI11_FORCE_LIBCXX OFF)
set(CLI11_CUDA_TESTS OFF)
set(CLI11_CLANG_TIDY OFF)
add_subdirectory(CLI11)

# --- alpaka ---

# alpaka openmp backend
Expand Down Expand Up @@ -97,5 +76,32 @@ if(RAYX_ENABLE_H5)
endif()
endif()

if (RAYX_BUILD_TESTS)
set(gtest_force_shared_crt ON CACHE BOOL "Always use msvcrt.dll" FORCE)

add_subdirectory(googletest)
endif()

# --- CLI11 ---
if (RAYX_BUILD_RAYX_CLI)
set(CLI11_SANITIZERS OFF)
set(CLI11_BUILD_DOCS OFF)
set(CLI11_BUILD_TESTS OFF)
set(CLI11_BUILD_EXAMPLES OFF)
set(CLI11_BUILD_EXAMPLES_JSON OFF)
set(CLI11_SINGLE_FILE_TESTS OFF)
set(CLI11_INSTALL OFF)
set(CLI11_FORCE_LIBCXX OFF)
set(CLI11_CUDA_TESTS OFF)
set(CLI11_CLANG_TIDY OFF)
add_subdirectory(CLI11)
endif()

# --- SDL ---
add_subdirectory(SDL EXCLUDE_FROM_ALL)
if(RAYX_BUILD_RAYX_UI)
# support version in CMakeLists.txt of portable-file-dialogs was removed from cmake. thus we include the header only library by hand
add_library(portable_file_dialogs INTERFACE)
target_include_directories(portable_file_dialogs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/portable-file-dialogs)

add_subdirectory(SDL EXCLUDE_FROM_ALL)
endif()
1 change: 0 additions & 1 deletion Extern/VMA
Submodule VMA deleted from 009ecd
10 changes: 6 additions & 4 deletions Intern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ endif()
# ---- Subdirectories ----
add_subdirectory(rayx-core)

if(NOT RAYX_CMD STREQUAL "NO")
if(RAYX_BUILD_RAYX_CLI)
add_subdirectory(rayx)
endif()

# Don't build rayx-ui without Vulkan
if(NOT VULKAN STREQUAL "NO")
add_subdirectory(rayx-ui)
if(RAYX_BUILD_RAYX_UI)
# Don't build rayx-ui without Vulkan
if(NOT VULKAN STREQUAL "NO")
add_subdirectory(rayx-ui)
endif()
endif()

# ------------------------
5 changes: 3 additions & 2 deletions Intern/rayx-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ endif()
# -----------------------

# ---- Add tests ----
add_subdirectory(tests)
if(RAYX_BUILD_RAYX_TESTS)
add_subdirectory(tests)
endif()

# -------------------

Expand Down Expand Up @@ -192,7 +194,6 @@ target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${PROJECT_SOURCE_DIR
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
${PROJECT_SOURCE_DIR}/../../Extern/glm/glm/
${PROJECT_SOURCE_DIR}/../../Extern/rapidxml-1.13/
${PROJECT_SOURCE_DIR}/../../Extern/VMA/include/
${PROJECT_SOURCE_DIR}/../../Extern/alpaka/include/
)
target_link_libraries(${PROJECT_NAME} PUBLIC alpaka::alpaka)
Expand Down
18 changes: 0 additions & 18 deletions Intern/rayx-core/src/Core.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
#pragma once

// Memory leak detection (RAYX_NEW instead of new allows leaks to be detected)
#ifdef RAYX_DEBUG_MODE
#ifdef RAYX_PLATFORM_MSVC
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#define RAYX_NEW new (_NORMAL_BLOCK, __FILE__, __LINE__)
#else
#define RAYX_NEW new
#endif

/**
* Defining the RAYX_API macro, which helps with
* building the library (context based import/export of code).
Expand Down Expand Up @@ -41,13 +30,6 @@
#endif
#endif

// make string comparison available for msvc compiler
// not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif

#ifdef RAYX_BUILD_DLL
#include <alpaka/core/Common.hpp>
#define RAYX_FN_ACC ALPAKA_FN_ACC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ struct EnergyDistributionList {
};

struct EnergyDistributionDataBase {
using HardEdge = rayx::HardEdge;
using SoftEdge = rayx::SoftEdge;
using SeparateEnergies = rayx::SeparateEnergies;
using HardEdge = rayx::HardEdge;
using SoftEdge = rayx::SoftEdge;
using SeparateEnergies = rayx::SeparateEnergies;
using EnergyDistributionList = rayx::EnergyDistributionList;
};

using EnergyDistributionDataVariant = Variant<EnergyDistributionDataBase, EnergyDistributionDataBase::HardEdge, EnergyDistributionDataBase::SoftEdge, SeparateEnergies, EnergyDistributionDataBase::EnergyDistributionList>;
using EnergyDistributionDataVariant = Variant<EnergyDistributionDataBase, EnergyDistributionDataBase::HardEdge, EnergyDistributionDataBase::SoftEdge,
SeparateEnergies, EnergyDistributionDataBase::EnergyDistributionList>;

RAYX_FN_ACC double selectEnergy(const HardEdge& __restrict hardEdge, Rand& __restrict rand);
RAYX_FN_ACC double selectEnergy(const SoftEdge& __restrict softEdge, Rand& __restrict rand);
Expand Down
48 changes: 30 additions & 18 deletions Intern/rayx-core/src/Tracer/DeviceConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ DeviceType platformToDeviceType();

template <>
DeviceType platformToDeviceType<alpaka::PlatformCpu>() {
return DeviceType::Cpu;
#if defined(RAYX_OPENMP_ENABLED)
return DeviceType::CpuParallel;
#else
return DeviceType::CpuSerial;
#endif
}

#if defined(RAYX_CUDA_ENABLED)
Expand All @@ -30,13 +34,6 @@ DeviceType platformToDeviceType<alpaka::PlatformCudaRt>() {
}
#endif

#if defined(RAYX_HIP_ENABLED)
template <>
DeviceType platformToDeviceType<alpaka::PlatformHipRt>() {
return DeviceType::GpuHip;
}
#endif

template <typename AccTag>
std::vector<Device> getAvailableDevicesProps() {
std::vector<Device> devices;
Expand Down Expand Up @@ -80,31 +77,26 @@ std::vector<Device> getAvailableDevices(DeviceType deviceType = DeviceType::All)
};

#if defined(RAYX_OPENMP_ENABLED)
using TagCpu = alpaka::TagCpuOmp2Blocks;
if (deviceType & DeviceType::CpuParallel) append(alpaka::TagCpuOmp2Blocks{});
#else
using TagCpu = alpaka::TagCpuSerial;
if (deviceType & DeviceType::CpuSerial) append(alpaka::TagCpuSerial{});
#endif
if (deviceType & DeviceType::Cpu) append(TagCpu{});

#if defined(RAYX_CUDA_ENABLED)
if (deviceType & DeviceType::GpuCuda) append(alpaka::TagGpuCudaRt{});
#endif

#if defined(RAYX_HIP_ENABLED)
if (deviceType & DeviceType::GpuHip) append(alpaka::TagGpuHipRt{});
#endif

return devices;
}

std::string deviceTypeToString(DeviceType deviceType) {
std::vector<const char*> names;

if (deviceType & DeviceType::Cpu) names.push_back("Cpu");
if (deviceType & DeviceType::CpuSerial) names.push_back("CpuSerial");
if (deviceType & DeviceType::CpuParallel) names.push_back("CpuParallel");
if (deviceType & DeviceType::GpuCuda) names.push_back("GpuCuda");
if (deviceType & DeviceType::GpuHip) names.push_back("GpuHip");

if (names.empty()) names.push_back("Unsupported");
if (names.empty()) names.push_back("None");

std::stringstream ss;

Expand All @@ -130,6 +122,10 @@ void DeviceConfig::dumpDevices() const {
const auto& device = devices[i];
RAYX_LOG << "Device - index: " << i << ", type: " << deviceTypeToString(device.type) << ", name: " << device.name;
}

#if !defined(RAYX_CUDA_ENABLED)
if (!(m_fetchedDeviceType & DeviceType::Cpu)) RAYX_WARN << "GPU support is not enabled in this build.";
#endif
}

size_t DeviceConfig::enabledDevicesCount() const {
Expand Down Expand Up @@ -192,4 +188,20 @@ DeviceConfig& DeviceConfig::enableBestDevice(DeviceType deviceType) {
return *this;
}

DeviceConfig::DeviceType DeviceConfig::availableDeviceTypes() {
DeviceType deviceType = DeviceType::None;

#if defined(RAYX_OPENMP_ENABLED)
deviceType = static_cast<DeviceType>(deviceType | DeviceType::CpuParallel);
#else
deviceType = static_cast<DeviceType>(deviceType | DeviceType::CpuSerial);
#endif

#if defined(RAYX_CUDA_ENABLED)
deviceType = static_cast<DeviceType>(deviceType | DeviceType::GpuCuda);
#endif

return deviceType;
}

} // namespace rayx
13 changes: 8 additions & 5 deletions Intern/rayx-core/src/Tracer/DeviceConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ namespace rayx {

struct RAYX_API DeviceConfig {
enum RAYX_API DeviceType {
Unsupported = 0,
Cpu = 1 << 0,
GpuCuda = 1 << 1,
GpuHip = 1 << 2,
Gpu = GpuCuda | GpuHip,
None = 0,
CpuSerial = 1 << 0,
CpuParallel = 1 << 1,
Cpu = CpuSerial | CpuParallel,
GpuCuda = 1 << 2,
Gpu = GpuCuda,
All = Cpu | Gpu,
};

Expand Down Expand Up @@ -46,6 +47,8 @@ struct RAYX_API DeviceConfig {

DeviceConfig& enableBestDevice(DeviceType deviceType = DeviceType::All);

static DeviceType availableDeviceTypes();

std::vector<Device> devices;

private:
Expand Down
7 changes: 0 additions & 7 deletions Intern/rayx-core/src/Tracer/Tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ inline std::shared_ptr<rayx::DeviceTracer> createDeviceTracer(DeviceType deviceT
#else
RAYX_EXIT << "Failed to create Tracer with Cuda device. Cuda was disabled during build.";
return nullptr;
#endif
case DeviceType::GpuHip:
#if defined(RAYX_HIP_ENABLED)
eturn std::make_shared<rayx::MegaKernelTracer<alpaka::TagGpuHipRt>>(deviceIndex);
#else
RAYX_EXIT << "Failed to create Tracer with Hip device. Hip was disabled during build.";
return nullptr;
#endif
default: // case DeviceType::Cpu
#if defined(RAYX_OPENMP_ENABLED)
Expand Down
7 changes: 6 additions & 1 deletion Scripts/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ pkgs.mkShell {
gdb
cmake
ninja
llvmPackages.openmp
# cudaPackages.cuda_cudart
# cudaPackages.cuda_nvcc
# cudaPackages.cuda_cccl

# rayx-core dependencies
hdf5
Expand All @@ -30,6 +34,7 @@ pkgs.mkShell {
vulkan-headers
vulkan-loader
vulkan-validation-layers
vulkan-extension-layer
vulkan-tools
vulkan-tools-lunarg
vulkan-utility-libraries
Expand All @@ -52,7 +57,7 @@ pkgs.mkShell {
];

shellHook = ''
export CMAKE_PREFIX_PATH=${pkgs.boost}:${pkgs.hdf5}:${pkgs.cmake}:${pkgs.pkg-config};
export CMAKE_PREFIX_PATH=${pkgs.hdf5}:${pkgs.cmake}:${pkgs.pkg-config}:${pkgs.vulkan-headers}:${pkgs.vulkan-loader}:${pkgs.vulkan-validation-layers}:${pkgs.vulkan-extension-layer}:${pkgs.vulkan-tools}:${pkgs.vulkan-tools-lunarg}:${pkgs.vulkan-utility-libraries};
export VK_LAYER_PATH="${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
'';
}
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading