Maestro 0.3.1
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
GpuLibraryRegistry.h
Go to the documentation of this file.
1
2#pragma once
3
4#ifdef __linux__
5#include "GpuLibrary.h"
6#include <memory>
7#include <string>
8#include <utility>
9
10namespace Simulators {
11class GpuLibraryRegistry {
12 public:
13 explicit GpuLibraryRegistry(std::string path = "libmaestro_gpu_simulators.so")
14 : path(std::move(path)) {}
15
16 std::shared_ptr<GpuLibrary> Acquire(int device, bool mute = false) {
17 auto library = GpuLibrary::GetInstance();
18 return library->InitializeForDevice(path.c_str(), device, mute) ? library : nullptr;
19 }
20
21 int DeviceCount() {
22 return GpuLibrary::GetInstance()->DiscoverDevices(path.c_str());
23 }
24
25 private:
26 std::string path;
27};
28} // namespace Simulators
29#endif