Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
python_module.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef REALM_PYTHON_MODULE_H
19#define REALM_PYTHON_MODULE_H
20
21#include "realm/realm_config.h"
22#include "realm/module.h"
23
24#include <set>
25
26namespace Realm {
27
28 namespace Python {
29
31 friend class PythonModule;
32
33 protected:
35
36 public:
37 virtual void configure_from_cmdline(std::vector<std::string> &cmdline);
38
39 protected:
41 size_t cfg_stack_size = 2 << 20;
42#ifdef REALM_USE_OPENMP
43 int cfg_pyomp_threads = 0;
44#endif
45 std::vector<std::string> cfg_import_modules;
46 std::vector<std::string> cfg_init_scripts;
47 };
48
49 // our interface to the rest of the runtime
51 protected:
53
54 public:
55 virtual ~PythonModule(void);
56
57 // Request that the named Python module be imported
58 static void import_python_module(const char *module_name);
59
61
62 static Module *create_module(RuntimeImpl *runtime);
63
64 // do any general initialization - this is called after all configuration is
65 // complete
66 virtual void initialize(RuntimeImpl *runtime);
67
68 // create any memories provided by this module (default == do nothing)
69 // (each new MemoryImpl should use a Memory from RuntimeImpl::next_local_memory_id)
70 // virtual void create_memories(RuntimeImpl *runtime);
71
72 // create any processors provided by the module (default == do nothing)
73 // (each new ProcessorImpl should use a Processor from
74 // RuntimeImpl::next_local_processor_id)
75 virtual void create_processors(RuntimeImpl *runtime);
76
77 // create any DMA channels provided by the module (default == do nothing)
78 // virtual void create_dma_channels(RuntimeImpl *runtime);
79
80 // create any code translators provided by the module (default == do nothing)
81 // virtual void create_code_translators(RuntimeImpl *runtime);
82
83 // clean up any common resources created by the module - this will be called
84 // after all memories/processors/etc. have been shut down and destroyed
85 virtual void cleanup(void);
86
87 public:
88 static std::vector<std::string> extra_import_modules;
89
91 };
92
93 }; // namespace Python
94
95}; // namespace Realm
96
97#endif
Definition module_config.h:32
Definition module.h:42
Definition python_module.h:30
std::vector< std::string > cfg_init_scripts
Definition python_module.h:46
std::vector< std::string > cfg_import_modules
Definition python_module.h:45
virtual void configure_from_cmdline(std::vector< std::string > &cmdline)
size_t cfg_stack_size
Definition python_module.h:41
int cfg_num_python_cpus
Definition python_module.h:40
Definition python_module.h:50
static std::vector< std::string > extra_import_modules
Definition python_module.h:88
virtual void initialize(RuntimeImpl *runtime)
static void import_python_module(const char *module_name)
static Module * create_module(RuntimeImpl *runtime)
static ModuleConfig * create_module_config(RuntimeImpl *runtime)
PythonModuleConfig * config
Definition python_module.h:90
virtual void create_processors(RuntimeImpl *runtime)
virtual void cleanup(void)
Definition runtime_impl.h:264
#define REALM_PUBLIC_API
Definition compiler_support.h:217
Definition activemsg.h:38