27#if defined(CUDA) && defined(WALBERLA)
32#include <unordered_map>
44 if (
context()->is_head_node()) {
57 if (
name ==
"list_devices") {
58 std::unordered_map<int, std::string>
devices{};
60 if (
context()->is_head_node()) {
64 for (
int i = 0; i <
n_gpus; ++i) {
75 if (
name ==
"list_devices_properties") {
76 std::unordered_map<std::string, std::unordered_map<int, Variant>>
dict{};
85 {
"name", std::string{
dev.name}},
86 {
"compute_capability",
88 {
dev.compute_capability_major,
dev.compute_capability_minor}}}},
89 {
"cores",
dev.n_cores},
90 {
"total_memory",
dev.total_memory},
97 if (
name ==
"get_n_gpus") {
100 if (
context()->is_head_node()) {
107#if defined(CUDA) && defined(WALBERLA)
108 if (
name ==
"set_device_id_per_rank") {
void add_parameters(std::vector< AutoParameter > &¶ms)
virtual bool is_head_node() const =0
boost::string_ref name() const
Context * context() const
Responsible context.
Variant do_call_method(std::string const &name, VariantMap const ¶meters) override
This file contains the defaults for ESPResSo.
void invoke_skip_cuda_exceptions(F &&f, Args &&...args)
Invoke a function and silently ignore any thrown cuda_runtime_error error.
std::vector< EspressoGpuDevice > cuda_gather_gpus()
Gather list of CUDA devices on all nodes on the head node.
int cuda_get_device()
Get the current CUDA device.
void cuda_set_device(int dev)
Choose a device for future CUDA computations.
void cuda_get_gpu_name(int dev, char *name)
Get the name of a CUDA device.
int cuda_get_n_gpus()
Get the number of CUDA devices.
void set_device_id_per_rank()
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
auto make_unordered_map_of_variants(std::unordered_map< K, V > const &v)
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.