Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
realm_config.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// configuration settings that control how Realm is built
19// this is expected to become an auto-generated file at some point
20
21#ifndef REALM_CONFIG_H
22#define REALM_CONFIG_H
23
24// realm_defines.h is auto-generated by both the make and cmake builds
25#include "realm_defines.h"
26
27// get macros that spell things the right way for each compiler
29
30#define REALM_EVENT_GENERATION_BITS 20
31
32// Control the maximum number of dimensions for Realm
33#ifndef REALM_MAX_DIM
34#define REALM_MAX_DIM 3
35#endif
36
37// if set, uses ucontext.h for user level thread switching, otherwise falls
38// back to POSIX threads
39// address sanitizer doesn't cope with makecontext/swapcontext either
40#if !defined(REALM_USE_NATIVE_THREADS) && !defined(REALM_ON_MACOS) && \
41 !defined(ASAN_ENABLED)
42// clang on Mac is generating apparently-broken code in the user thread
43// scheduler, so disable this code path for now
44#define REALM_USE_USER_THREADS
45#endif
46
47// dynamic loading via dlfcn and a not-completely standard dladdr extension
48#ifdef REALM_USE_LIBDL
49#if defined(REALM_ON_LINUX) || defined(REALM_ON_MACOS) || defined(REALM_ON_FREEBSD)
50#define REALM_USE_DLFCN
51#define REALM_USE_DLADDR
52#endif
53#endif
54
55// can Realm use exceptions to propagate errors back to the profiling interace?
56#define REALM_USE_EXCEPTIONS
57
58// the Realm operation table is needed if you want to be able to cancel operations
59#ifndef REALM_NO_USE_OPERATION_TABLE
60#define REALM_USE_OPERATION_TABLE
61#endif
62
63// maximum size in bytes of Realm error messages
64#ifndef REALM_ERROR_BUFFER_SIZE
65#define REALM_ERROR_BUFFER_SIZE 1024
66#endif
67
68// ASAN has issues with thread local destructors, so disable this path for asan
69// Temporarily disable the caching allocator until it is debugged
70// TODO: reenable this
71#define REALM_USE_CACHING_ALLOCATOR 0
72#if !defined(REALM_USE_CACHING_ALLOCATOR) && !defined(ASAN_ENABLED)
73#define REALM_USE_CACHING_ALLOCATOR 1
74#ifndef REALM_TASK_BLOCK_SIZE
75#define REALM_TASK_BLOCK_SIZE (128ULL * 1024ULL)
76#endif
77#endif
78
79#if defined(REALM_USE_SHM)
80// Unfortunately, the use of shared memory requires a named resource on the system, which
81// requires coordination of the name before the resources are allocated. GASNET1 does not
82// have the capability to communicate to other nodes before resource allocation is done,
83// so we cannot support shared memory with it at this time
84#if defined(REALM_USE_GASNET1)
85#error Shared memory not supported on GASNET1
86#endif
87
88#if defined(REALM_ON_WINDOWS)
89// ANONYMOUS_SHARED_MEMORY requires ipc mailbox support, which is not yet implemented on
90// windows
91// TODO: Support this on windows
92//#define REALM_USE_ANONYMOUS_SHARED_MEMORY 1
93#elif !defined(REALM_USE_ANONYMOUS_SHARED_MEMORY)
94// Use anonymous shared memory by default, as it has a lot fewer limitations and there are
95// more fallbacks in place
96#define REALM_USE_ANONYMOUS_SHARED_MEMORY 1
97#endif
98#endif
99
100#ifdef __cplusplus
101// runtime configuration settings
102namespace Realm {
103 namespace Config {
104 // if non-zero, eagerly checks deferred user event triggers for loops up to the
105 // specified limit
106 extern int event_loop_detection_limit;
107
108 // if true, worker threads that might have used user-level thread switching
109 // fall back to kernel threading
110 extern bool force_kernel_threads;
111 // Unique identifier for the job assigned to this instance of the machine. Useful
112 // when dealing with named system resources while running parallel jobs on the same
113 // machine
114 extern unsigned long long job_id;
115 }; // namespace Config
116}; // namespace Realm
117#endif
118
119#endif
Definition activemsg.h:38