Skip to content

Commit 94eb75b

Browse files
committed
[RM] partial json system_config
1 parent 92921ed commit 94eb75b

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.13)
2+
cmake_policy(SET CMP0135 NEW) # ExternalProject downloads will have archive timestamps
23

34
set(SIMSYCL_VERSION 0.1)
45
set(SIMSYCL_VERSION_MAJOR 0)
@@ -26,6 +27,19 @@ endif()
2627

2728
find_package(Boost 1.70 COMPONENTS context REQUIRED)
2829

30+
include(FetchContent)
31+
32+
set(JSON_BuildTests OFF CACHE INTERNAL "")
33+
set(JSON_Install ON CACHE INTERNAL "")
34+
35+
FetchContent_Declare(
36+
nlohmann_json
37+
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
38+
URL_HASH SHA256=d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d
39+
)
40+
41+
FetchContent_MakeAvailable(nlohmann_json)
42+
2943
include(CheckTypeSize)
3044
check_type_size(_Float16 FLOAT16 BUILTIN_TYPES_ONLY LANGUAGE CXX)
3145
if (HAVE_FLOAT16)
@@ -121,9 +135,13 @@ add_library(simsycl
121135
src/simsycl/platform.cc
122136
src/simsycl/queue.cc
123137
src/simsycl/system.cc
138+
src/simsycl/system_config.cc
124139
src/simsycl/templates.cc
125140
)
126-
target_link_libraries(simsycl Boost::context)
141+
target_link_libraries(simsycl PRIVATE
142+
Boost::context
143+
nlohmann_json::nlohmann_json
144+
)
127145
target_include_directories(simsycl PUBLIC
128146
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
129147
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>

src/simsycl/system_config.cc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <simsycl/system.hh>
2+
3+
#include <nlohmann/json.hpp>
4+
5+
6+
namespace simsycl::sycl { // nlohmann_json requires us to invoke SERIALIZE_ENUM in this namespace
7+
8+
NLOHMANN_JSON_SERIALIZE_ENUM(aspect,
9+
{
10+
{aspect::cpu, "cpu"},
11+
{aspect::gpu, "gpu"},
12+
{aspect::accelerator, "accelerator"},
13+
{aspect::custom, "custom"},
14+
{aspect::emulated, "emulated"},
15+
{aspect::host_debuggable, "host_debuggable"},
16+
{aspect::fp16, "fp16"},
17+
{aspect::fp64, "fp64"},
18+
{aspect::atomic64, "atomic64"},
19+
{aspect::image, "image"},
20+
{aspect::online_compiler, "online_compiler"},
21+
{aspect::online_linker, "online_linker"},
22+
{aspect::queue_profiling, "queue_profiling"},
23+
{aspect::usm_device_allocations, "usm_device_allocations"},
24+
{aspect::usm_host_allocations, "usm_host_allocations"},
25+
{aspect::usm_atomic_host_allocations, "usm_atomic_host_allocations"},
26+
{aspect::usm_shared_allocations, "usm_shared_allocations"},
27+
{aspect::usm_atomic_shared_allocations, "usm_atomic_shared_allocations"},
28+
{aspect::usm_system_allocations, "usm_system_allocations"},
29+
})
30+
31+
}
32+
33+
namespace simsycl::detail {
34+
35+
device_config load_device_config(const std::string &path_to_json_file) {}
36+
37+
} // namespace simsycl::detail

0 commit comments

Comments
 (0)