Skip to content

Commit

Permalink
Configure SimSYCL system
Browse files Browse the repository at this point in the history
  • Loading branch information
fknorr committed Jan 22, 2024
1 parent c85e816 commit eca518f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <catch2/reporters/catch_reporter_event_listener.hpp>
#include <catch2/reporters/catch_reporter_registrars.hpp>

#if CELERITY_SIMSYCL
#include <simsycl/system.hh>
#endif

/**
* We provide a custom main function to add additional CLI flags.
*/
Expand All @@ -19,6 +23,23 @@ int main(int argc, char* argv[]) {
int return_code = session.applyCommandLine(argc, argv);
if(return_code != 0) { return return_code; }

#if CELERITY_SIMSYCL
{
// There are tests (buffer_manager_tests) which allocate a fixed fraction of the device global memory, so the device needs to report a reasonably small
// value to avoid attempts to allocate the entire address space (default device has global_mem_size = SIZE_MAX)
auto sim_device = simsycl::builtin_device;
sim_device.global_mem_size = 1 << 30; // 1 GiB

simsycl::system_config sim_system;
sim_system.platforms = {{"SimSYCL", simsycl::builtin_platform}};
for(int i = 0; i < 4; ++i) {
sim_system.devices.emplace(fmt::format("GPU#{}", i), sim_device);
}

simsycl::configure_system(sim_system);
}
#endif

// allow unit tests to catch and recover from panics
celerity::detail::utils::set_panic_solution(celerity::detail::utils::panic_solution::throw_logic_error);

Expand Down

0 comments on commit eca518f

Please sign in to comment.