NewMadeleine

Documentation

« back to PM2 home.
nm_public.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2026 (see AUTHORS file)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16#ifndef NM_PUBLIC_H
17#define NM_PUBLIC_H
18
47#include <stdlib.h>
48#include <stdio.h>
49#include <stdint.h>
50#include <unistd.h>
51#include <nm_config.h>
52#include <nm_errno.h>
53#include <nm_types.h>
54#include <Padico/Puk.h>
55#if defined(NMAD_PIOMAN)
56# include <pioman.h>
57#endif
58
59/* ** Display info & warnings ****************************** */
60
61#define NM_DISPF(str, ...) padico_out(puk_verbose_info, str, ## __VA_ARGS__)
62
63#define NM_TRACEF(str, ...) padico_trace(str, ## __VA_ARGS__)
64
65#define NM_WARN(format, ...) padico_warning(format, ## __VA_ARGS__)
66
67#define NM_FATAL(format, ...) padico_fatal(format, ## __VA_ARGS__)
68
69/* ** C++ external linkage ********************************* */
70
71#ifdef __cplusplus
72#define NM_EXTERN_C extern "C"
73#define NM_EXTERN_C_BEGIN extern "C" {
74#define NM_EXTERN_C_END }
75#else /* __cplusplus */
76#define NM_EXTERN_C
77#define NM_EXTERN_C_BEGIN
78#define NM_EXTERN_C_END
79#endif /* __cplusplus */
80
81/* ** Config sanity checks ********************************* */
82
91#if !defined(NMAD)
92# error "nmad CFLAGS not defined; please compile with CFLAGS returned by 'pkg-config --cflags nmad'"
93#endif /* NMAD */
94
95#if defined(NMAD_PIOMAN) && !defined(PIOMAN)
96# error "nmad was configured with pioman support; cannot build without pioman flags."
97#endif
98
99#if defined(PIOMAN) && !defined(NMAD_PIOMAN)
100# error "nmad was configured without pioman support; cannot build with pioman flags."
101#endif
102
103#if defined(NMAD_PUKABI) && !defined(PUKABI)
104# error "nmad was configured with PukABI support; cannot build without PukABI flags."
105#endif
106
107#if defined(PUKABI) && !defined(NMAD_PUKABI)
108# error "nmad was configured without PukABI support; cannot build with PukABI flags."
109#endif
110
111#if defined(PIOMAN_TOPOLOGY_HWLOC) && !defined(NMAD_HWLOC)
112# error "pioman was configured with hwloc, but nmad was configured without hwloc."
113#endif
114
115#if defined(NMAD_SIMGRID) && !defined(PUK_SIMGRID)
116# error "nmad was configured with simgrid, but Puk was configured without simgrid."
117#endif
118
119#if defined(PUK_SIMGRID) && !defined(NMAD_SIMGRID)
120# error "Puk was configured with simgrid, but nmad was configured without simgrid."
121#endif
122
123#if defined(NMAD_SIMGRID) && (defined(PIOMAN) && !defined(PIOMAN_SIMGRID))
124# error "nmad was configured with simgrid, but pioman was configured without simgrid."
125#endif
126
127
128/* ** ABI config ******************************************* */
129
130#ifdef NMAD_PIOMAN
131# define NMAD_CONFIG_PIOMAN 1
132#else
133# define NMAD_CONFIG_PIOMAN 0
134#endif
135
136#ifdef NMAD_HWLOC
137# define NMAD_CONFIG_HWLOC 1
138#else
139# define NMAD_CONFIG_HWLOC 0
140#endif
141
142#ifdef NMAD_PUKABI
143# define NMAD_CONFIG_PUKABI 1
144#else
145# define NMAD_CONFIG_PUKABI 0
146#endif
147
148#ifdef NMAD_DEBUG
149# define NMAD_CONFIG_DEBUG 1
150#else
151# define NMAD_CONFIG_DEBUG 0
152#endif
153
154#ifdef NDEBUG
155# define NMAD_CONFIG_NDEBUG 1
156#else
157# define NMAD_CONFIG_NDEBUG 0
158#endif
159
160#ifdef NMAD_SIMGRID
161# define NMAD_CONFIG_SIMGRID 1
162#else
163# define NMAD_CONFIG_SIMGRID 0
164#endif
165
166#ifdef NMAD_CUDA
167# define NMAD_CONFIG_CUDA 1
168#else
169# define NMAD_CONFIG_CUDA 0
170#endif
171
172#ifdef NMAD_HIP
173# define NMAD_CONFIG_HIP 1
174#else
175# define NMAD_CONFIG_HIP 0
176#endif
177
178#define NM_TOSTRING2(s) #s
179#define NM_TOSTRING(s) NM_TOSTRING2(s)
180
183#define NMAD_CONFIG_STRING \
184 " pioman = " NM_TOSTRING(NMAD_CONFIG_PIOMAN) \
185 " hwloc = " NM_TOSTRING(NMAD_CONFIG_HWLOC) \
186 " pukabi = " NM_TOSTRING(NMAD_CONFIG_PUKABI) \
187 " debug = " NM_TOSTRING(NMAD_CONFIG_DEBUG) \
188 " ndebug = " NM_TOSTRING(NMAD_CONFIG_NDEBUG) \
189 " simgrid = " NM_TOSTRING(NMAD_CONFIG_SIMGRID) \
190 " cuda = " NM_TOSTRING(NMAD_CONFIG_CUDA) \
191 " hip = " NM_TOSTRING(NMAD_CONFIG_HIP)
192
196#define NMAD_ABI_CONFIG_STRING \
197 " pioman = " NM_TOSTRING(NMAD_CONFIG_PIOMAN) \
198 " hwloc = " NM_TOSTRING(NMAD_CONFIG_HWLOC) \
199 " pukabi = " NM_TOSTRING(NMAD_CONFIG_PUKABI) \
200 " debug = " NM_TOSTRING(NMAD_CONFIG_DEBUG) \
201 " simgrid = " NM_TOSTRING(NMAD_CONFIG_SIMGRID) \
202 " cuda = " NM_TOSTRING(NMAD_CONFIG_CUDA) \
203 " hip = " NM_TOSTRING(NMAD_CONFIG_HIP)
204
206
209static inline void nm_abi_config_check(void)
210{
211 /* capture ABI config in application context
212 * and compare with nmad builtin ABI config */
214}
215
219#endif /* NM_PUBLIC_H */
#define NMAD_ABI_CONFIG_STRING
config options that impact nmad ABI (content of structures exposed in API or used in inline code)
Definition nm_public.h:196
void nm_abi_config_check_internal(const char *p_config)
static void nm_abi_config_check(void)
Check consistency of ABI config between nmad and application.
Definition nm_public.h:209
This file contains error codes definitions.
#define NM_EXTERN_C
Definition nm_public.h:76
This file contains some types and constants used throughout NewMad core and interfaces.