Skip to content

Commit

Permalink
Update Circuit example from Legion master.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Mar 4, 2024
1 parent 2532790 commit 6c08c3e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 23 deletions.
13 changes: 7 additions & 6 deletions examples/circuit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------#
# Copyright 2023 Kitware, Inc., Stanford University
# Copyright 2024 Kitware, Inc., Stanford University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -21,15 +21,17 @@ set(CPU_SOURCES
circuit_mapper.h circuit_mapper.cc
)
if(Legion_USE_CUDA)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Wno-deprecated-gpu-targets)
set(GPU_SOURCES circuit_gpu.cu)
cuda_add_executable(circuit ${CPU_SOURCES} ${GPU_SOURCES})
add_executable(circuit ${CPU_SOURCES} ${GPU_SOURCES})
set_target_cuda_standard(circuit STANDARD ${Legion_CUDA_STANDARD})
set_target_cuda_architectures(circuit ARCHITECTURES ${Legion_CUDA_ARCH})
set_target_cuda_warnings_and_errors(circuit WARN_AS_ERROR ${Legion_BUILD_WARN_AS_ERROR})
elseif(Legion_USE_HIP)
set(GPU_SOURCES circuit_gpu.cu)
if(Legion_HIP_TARGET STREQUAL "CUDA")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Wno-deprecated-gpu-targets)
cuda_add_executable(circuit ${CPU_SOURCES} ${GPU_SOURCES})
add_executable(circuit ${CPU_SOURCES} ${GPU_SOURCES})
target_compile_definitions(circuit PRIVATE __HIP_PLATFORM_NVIDIA__)
target_include_directories(circuit PRIVATE ${HIP_ROOT_DIR}/include)
elseif (Legion_HIP_TARGET STREQUAL "ROCM")
hip_add_executable(circuit ${CPU_SOURCES} ${GPU_SOURCES})
target_compile_definitions(circuit PRIVATE __HIP_PLATFORM_AMD__)
Expand All @@ -38,6 +40,5 @@ else()
add_executable(circuit ${CPU_SOURCES})
endif()
target_link_libraries(circuit Legion::Legion ResilienceStatic)
set_target_properties(circuit PROPERTIES CXX_STANDARD 11)
add_test(NAME circuit COMMAND ${PROJECT_SOURCE_DIR}/tests/runner.py -- ${RESILIENCE_TEST_LAUNCHER} $<TARGET_FILE:circuit> -lg:eager_alloc_percentage 20 -lg:safe_ctrlrepl 2)
add_test(NAME circuit_disable COMMAND ${PROJECT_SOURCE_DIR}/tests/runner.py -- ${RESILIENCE_TEST_LAUNCHER} $<TARGET_FILE:circuit> -lg:eager_alloc_percentage 20 -lg:safe_ctrlrepl 2 -checkpoint:disable)
2 changes: 1 addition & 1 deletion examples/circuit/circuit.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion examples/circuit/circuit.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions examples/circuit/circuit_cpu.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -663,9 +663,9 @@ void UpdateVoltagesTask::cpu_base_impl(const CircuitPiece &piece,
const AccessorROfloat fa_cap(regions.begin()+2, regions.end(), FID_NODE_CAP);
const AccessorROfloat fa_leakage(regions.begin()+2, regions.end(), FID_LEAKAGE);

for (unsigned idx = 0; idx < piece.num_wires; idx++)
for (unsigned idx = 0; idx < piece.num_nodes; idx++)
{
const Point<1> node_ptr = piece.first_wire + idx;
const Point<1> node_ptr = piece.first_node + idx;
float voltage = fa_voltage[node_ptr];
float charge = fa_charge[node_ptr];
float capacitance = fa_cap[node_ptr];
Expand Down
2 changes: 1 addition & 1 deletion examples/circuit/circuit_gpu.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion examples/circuit/circuit_init.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion examples/circuit/circuit_mapper.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
18 changes: 9 additions & 9 deletions examples/circuit/circuit_mapper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Stanford University
/* Copyright 2024 Stanford University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,14 +34,14 @@ class CircuitMapper : public DefaultMapper {
std::map<Processor, Memory>* proc_fbmems,
std::map<Processor, Memory>* proc_zcmems);
public:
virtual void map_task(const MapperContext ctx,
const Task& task,
const MapTaskInput& input,
MapTaskOutput& output);
virtual void map_inline(const MapperContext ctx,
const InlineMapping& inline_op,
const MapInlineInput& input,
MapInlineOutput& output);
void map_task(const MapperContext ctx,
const Task& task,
const MapTaskInput& input,
MapTaskOutput& output) override;
void map_inline(const MapperContext ctx,
const InlineMapping& inline_op,
const MapInlineInput& input,
MapInlineOutput& output) override;
protected:
void map_circuit_region(const MapperContext ctx, LogicalRegion region,
Processor target_proc, Memory target,
Expand Down

0 comments on commit 6c08c3e

Please sign in to comment.