mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
[C++ API][Fix] support ray::Init without RayConfig (#17733)
This commit is contained in:
parent
ab53c5fc93
commit
63f9ba2858
2 changed files with 11 additions and 11 deletions
|
@ -28,9 +28,8 @@ class Counter {
|
||||||
RAY_REMOTE(Counter::FactoryCreate, &Counter::Add);
|
RAY_REMOTE(Counter::FactoryCreate, &Counter::Add);
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
/// configuration and initialization
|
/// initialization
|
||||||
ray::RayConfig config;
|
ray::Init();
|
||||||
ray::Init(config);
|
|
||||||
|
|
||||||
/// put and get object
|
/// put and get object
|
||||||
auto object = ray::Put(100);
|
auto object = ray::Put(100);
|
||||||
|
|
|
@ -19,20 +19,21 @@
|
||||||
|
|
||||||
namespace ray {
|
namespace ray {
|
||||||
|
|
||||||
void Init(ray::RayConfig &config, int *argc, char ***argv) {
|
void Init(RayConfig &config, int *argc, char ***argv) {
|
||||||
ray::internal::ConfigInternal::Instance().Init(config, argc, argv);
|
ray::internal::ConfigInternal::Instance().Init(config, argc, argv);
|
||||||
Init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Init(ray::RayConfig &config) { Init(config, nullptr, nullptr); }
|
|
||||||
|
|
||||||
void Init() {
|
|
||||||
std::call_once(is_inited_, [] {
|
std::call_once(is_inited_, [] {
|
||||||
auto runtime = ray::internal::AbstractRayRuntime::DoInit();
|
auto runtime = ray::internal::AbstractRayRuntime::DoInit();
|
||||||
ray::internal::RayRuntimeHolder::Instance().Init(runtime);
|
ray::internal::RayRuntimeHolder::Instance().Init(runtime);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Init(RayConfig &config) { Init(config, nullptr, nullptr); }
|
||||||
|
|
||||||
|
void Init() {
|
||||||
|
RayConfig config;
|
||||||
|
Init(config, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void Shutdown() { ray::internal::AbstractRayRuntime::DoShutdown(); }
|
void Shutdown() { ray::internal::AbstractRayRuntime::DoShutdown(); }
|
||||||
|
|
||||||
} // namespace ray
|
} // namespace ray
|
||||||
|
|
Loading…
Add table
Reference in a new issue