NewMadeleine

Documentation

« back to PM2 home.
nm_public.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2025 (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 <nm_config.h>
51#include <nm_errno.h>
52#include <nm_log.h>
53#include <nm_types.h>
54#include <nm_data.h>
55#include <Padico/Puk.h>
56#if defined(NMAD_PIOMAN)
57# include <pioman.h>
58#endif
59
60/* ** Config sanity checks ********************************* */
61
70#if !defined(NMAD)
71# error "nmad CFLAGS not defined; please compile with CFLAGS returned by 'pkg-config --cflags nmad'"
72#endif /* NMAD */
73
74#if defined(NMAD_PIOMAN) && !defined(PIOMAN)
75# error "nmad was configured with pioman support; cannot build without pioman flags."
76#endif
77
78#if defined(PIOMAN) && !defined(NMAD_PIOMAN)
79# error "nmad was configured without pioman support; cannot build with pioman flags."
80#endif
81
82#if defined(NMAD_PUKABI) && !defined(PUKABI)
83# error "nmad was configured with PukABI support; cannot build without PukABI flags."
84#endif
85
86#if defined(PUKABI) && !defined(NMAD_PUKABI)
87# error "nmad was configured without PukABI support; cannot build with PukABI flags."
88#endif
89
90#if defined(PIOMAN_TOPOLOGY_HWLOC) && !defined(NMAD_HWLOC)
91# error "pioman was configured with hwloc, but nmad was configured without hwloc."
92#endif
93
94#if defined(NMAD_SIMGRID) && !defined(PUK_SIMGRID)
95# error "nmad was configured with simgrid, but Puk was configured without simgrid."
96#endif
97
98#if defined(PUK_SIMGRID) && !defined(NMAD_SIMGRID)
99# error "Puk was configured with simgrid, but nmad was configured without simgrid."
100#endif
101
102#if defined(NMAD_SIMGRID) && (defined(PIOMAN) && !defined(PIOMAN_SIMGRID))
103# error "nmad was configured with simgrid, but pioman was configured without simgrid."
104#endif
105
106
107/* ** ABI config ******************************************* */
108
109#ifdef NMAD_PIOMAN
110# define NMAD_CONFIG_PIOMAN 1
111#else
112# define NMAD_CONFIG_PIOMAN 0
113#endif
114
115#ifdef NMAD_HWLOC
116# define NMAD_CONFIG_HWLOC 1
117#else
118# define NMAD_CONFIG_HWLOC 0
119#endif
120
121#ifdef NMAD_PUKABI
122# define NMAD_CONFIG_PUKABI 1
123#else
124# define NMAD_CONFIG_PUKABI 0
125#endif
126
127#ifdef NMAD_DEBUG
128# define NMAD_CONFIG_DEBUG 1
129#else
130# define NMAD_CONFIG_DEBUG 0
131#endif
132
133#ifdef NDEBUG
134# define NMAD_CONFIG_NDEBUG 1
135#else
136# define NMAD_CONFIG_NDEBUG 0
137#endif
138
139#ifdef NMAD_SIMGRID
140# define NMAD_CONFIG_SIMGRID 1
141#else
142# define NMAD_CONFIG_SIMGRID 0
143#endif
144
145#ifdef NMAD_CUDA
146# define NMAD_CONFIG_CUDA 1
147#else
148# define NMAD_CONFIG_CUDA 0
149#endif
150
151#ifdef NMAD_HIP
152# define NMAD_CONFIG_HIP 1
153#else
154# define NMAD_CONFIG_HIP 0
155#endif
156
157#define nm_tostring2(s) #s
158#define nm_tostring(s) nm_tostring2(s)
159
162#define NMAD_CONFIG_STRING \
163 " pioman = " nm_tostring(NMAD_CONFIG_PIOMAN) \
164 " hwloc = " nm_tostring(NMAD_CONFIG_HWLOC) \
165 " pukabi = " nm_tostring(NMAD_CONFIG_PUKABI) \
166 " debug = " nm_tostring(NMAD_CONFIG_DEBUG) \
167 " ndebug = " nm_tostring(NMAD_CONFIG_NDEBUG) \
168 " simgrid = " nm_tostring(NMAD_CONFIG_SIMGRID) \
169 " cuda = " nm_tostring(NMAD_CONFIG_CUDA) \
170 " hip = " nm_tostring(NMAD_CONFIG_HIP)
171
175#define NMAD_ABI_CONFIG_STRING \
176 " pioman = " nm_tostring(NMAD_CONFIG_PIOMAN) \
177 " hwloc = " nm_tostring(NMAD_CONFIG_HWLOC) \
178 " pukabi = " nm_tostring(NMAD_CONFIG_PUKABI) \
179 " debug = " nm_tostring(NMAD_CONFIG_DEBUG) \
180 " simgrid = " nm_tostring(NMAD_CONFIG_SIMGRID) \
181 " cuda = " nm_tostring(NMAD_CONFIG_CUDA) \
182 " hip = " nm_tostring(NMAD_CONFIG_HIP)
183
184void nm_abi_config_check_internal(const char*p_config);
185
188static inline void nm_abi_config_check(void)
189{
190 /* capture ABI config in application context
191 * and compare with nmad builtin ABI config */
193}
194
198#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:175
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:188
High-level data manipulation through iterators.
This file contains error codes definitions.
Basic primitives to display info & warnings.
This file contains some types and constants used throughout NewMad core and interfaces.