underling  0.3.2
underling.h
Go to the documentation of this file.
1 /***************************************************************************
2 //-----------------------------------------------------------------------bl-
3 // underling 0.3.1: an FFTW MPI-based library for 3D pencil decompositions
4 // https://github.com/RhysU/underling
5 //
6 // Copyright (C) 2010--2013, 2026 Rhys Ulerich
7 // Copyright (C) 2012, 2013 The PECOS Development Team
8 //
9 // This file is part of underling.
10 //
11 // underling is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // underling is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with underling. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------el-
24 // $Id$
25 ***************************************************************************/
26 
27 #ifndef UNDERLING_H
28 #define UNDERLING_H
29 
30 #include <stddef.h>
31 #include <stdio.h>
32 #include <mpi.h>
33 #include <underling/visibility.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
63 typedef double underling_real;
64 
79 typedef struct underling_extents {
85  int start[4];
86 
93  int size[4];
94 
99  int stride[4];
100 
108  int order[4];
109 
119  size_t extent;
121 
124 
132 void
134  const underling_extents *extents,
135  FILE *output_file) UNDERLING_API;
136 
147 int
149  const underling_extents * const e2) UNDERLING_API;
150 
173 int underling_only_init(int *argc, char **argv[]) UNDERLING_API;
174 
200 int underling_init(int *argc, char **argv[], int nthreads) UNDERLING_API;
201 
210 void underling_only_cleanup() UNDERLING_API;
211 
226 void underling_cleanup() UNDERLING_API;
227 
238 typedef struct underling_grid_s *underling_grid;
239 
285  MPI_Comm comm,
286  int n0,
287  int n1,
288  int n2,
289  int pA,
290  int pB) UNDERLING_API;
291 
302 int
304  const underling_grid grid) UNDERLING_API;
305 
316 int
318  const underling_grid grid) UNDERLING_API;
319 
325 void
327  underling_grid grid) UNDERLING_API;
328 
336 void
338  const underling_grid grid,
339  FILE *output_file) UNDERLING_API;
340 
352 typedef struct underling_problem_s *underling_problem;
353 
375  underling_grid grid,
376  int howmany,
377  unsigned transposed_flags) UNDERLING_API;
378 
384 void
386  underling_problem problem) UNDERLING_API;
387 
395 void
397  const underling_problem problem,
398  FILE *output_file) UNDERLING_API;
399 
417  const underling_problem problem,
418  int i) UNDERLING_API;
419 
447 size_t
449  const underling_problem problem,
450  int i,
451  int *start,
452  int *size,
453  int *stride,
454  int *order) UNDERLING_API;
455 
466 size_t
468  const underling_problem problem) UNDERLING_API;
469 
480 size_t
482  const underling_problem problem) UNDERLING_API;
483 
495 size_t
497  const underling_grid grid,
498  const underling_problem problem) UNDERLING_API;
499 
511 size_t
513  const underling_grid grid,
514  const underling_problem problem) UNDERLING_API;
515 
527 size_t
529  const underling_grid grid,
530  const underling_problem problem) UNDERLING_API;
531 
543 size_t
545  const underling_grid grid,
546  const underling_problem problem) UNDERLING_API;
547 
554 #define UNDERLING_TRANSPOSE_LONG_N2_TO_LONG_N1 (1U << 0)
555 
562 #define UNDERLING_TRANSPOSE_LONG_N1_TO_LONG_N0 (1U << 1)
563 
570 #define UNDERLING_TRANSPOSE_LONG_N0_TO_LONG_N1 (1U << 2)
571 
578 #define UNDERLING_TRANSPOSE_LONG_N1_TO_LONG_N2 (1U << 3)
579 
593 #define UNDERLING_TRANSPOSE_NONE (1U << 4)
594 
596 #define UNDERLING_TRANSPOSE_ALL \
597  ( UNDERLING_TRANSPOSE_LONG_N2_TO_LONG_N1 \
598  | UNDERLING_TRANSPOSE_LONG_N1_TO_LONG_N0 \
599  | UNDERLING_TRANSPOSE_LONG_N0_TO_LONG_N1 \
600  | UNDERLING_TRANSPOSE_LONG_N1_TO_LONG_N2 )
601 
614 typedef struct underling_plan_s *underling_plan;
615 
677  const underling_problem problem,
678  underling_real * in,
679  underling_real * out,
680  unsigned transpose_flags,
681  unsigned fftw_rigor_flags) UNDERLING_API;
682 
688 void
690  underling_plan plan) UNDERLING_API;
691 
699 void
701  const underling_plan plan,
702  FILE *output_file) UNDERLING_API;
703 
724 int
726  const underling_plan plan,
727  underling_real * in,
728  underling_real * out) UNDERLING_API;
729 
735 int
737  const underling_plan plan,
738  underling_real * in,
739  underling_real * out) UNDERLING_API;
740 
746 int
748  const underling_plan plan,
749  underling_real * in,
750  underling_real * out) UNDERLING_API;
751 
757 int
759  const underling_plan plan,
760  underling_real * in,
761  underling_real * out) UNDERLING_API;
762 
775 #define UNDERLING_TRANSPOSED_LONG_N2 (1U << 4)
776 
789 #define UNDERLING_TRANSPOSED_LONG_N0 (1U << 5)
790 
793 #ifndef DOXYGEN_SHOULD_SKIP_THIS
794 // Quasi-hidden setting used for debugging deadlock conditions
795 MPI_Comm
796 underling_debug_transpose(
797  MPI_Comm comm) UNDERLING_API;
798 #endif
799 
800 #ifdef __cplusplus
801 } /* extern "C" */
802 #endif
803 
804 #endif // UNDERLING_H
underling_extents::extent
size_t extent
The total extent of all local information, excluding communication buffers, in units of underling_rea...
Definition: underling.h:119
underling_only_cleanup
void underling_only_cleanup()
Release all resources held by underling.
underling_local_memory
size_t underling_local_memory(const underling_problem problem)
Find the amount of local storage necessary to plan and execute a problem.
underling_extents::size
int size[4]
The amount of global data stored locally in directions n{0,1,2}.
Definition: underling.h:93
underling_local
size_t underling_local(const underling_problem problem, int i, int *start, int *size, int *stride, int *order)
Obtain the processor-local sizes, storage details, and global starting offsets when the data is long ...
underling_local_memory_optimum
size_t underling_local_memory_optimum(const underling_problem problem)
Find the amount of local storage necessary to merely hold a problem in memory.
underling_grid_create
underling_grid underling_grid_create(MPI_Comm comm, int n0, int n1, int n2, int pA, int pB)
Collectively create a reusable domain-to-processor mapping across the given MPI communicator.
underling_plan
struct underling_plan_s * underling_plan
A type encapsulating the FFTW MPI invocations necessary to transition from being long in one directio...
Definition: underling.h:614
underling_grid_destroy
void underling_grid_destroy(underling_grid grid)
Destroy all resources associated with the given grid.
underling_fprint_grid
void underling_fprint_grid(const underling_grid grid, FILE *output_file)
Dump an instance's internals in a debugging-friendly format.
underling_cleanup
void underling_cleanup()
Release all resources held by FFTW MPI, FFTW threading, and underling.
underling_grid_pA_size
int underling_grid_pA_size(const underling_grid grid)
Obtain the size of the processor grid in the pA direction.
underling_grid
struct underling_grid_s * underling_grid
A type encapsulating a reusable domain-to-processor mapping.
Definition: underling.h:238
underling_fprint_extents
void underling_fprint_extents(const underling_extents *extents, FILE *output_file)
Dump an instance's internals in a debugging-friendly format.
underling_fprint_plan
void underling_fprint_plan(const underling_plan plan, FILE *output_file)
Dump an instance's internals in a debugging-friendly format.
underling_extents::stride
int stride[4]
The stride between adjacent elements in directions n{0,1,2}.
Definition: underling.h:99
underling_execute_long_n2_to_long_n1
int underling_execute_long_n2_to_long_n1(const underling_plan plan, underling_real *in, underling_real *out)
Collectively transform data from being long in n2 within buffer in to being long in n1 within buffer ...
underling_grid_pB_size
int underling_grid_pB_size(const underling_grid grid)
Obtain the size of the processor grid in the pB direction.
underling_local_memory_maximum
size_t underling_local_memory_maximum(const underling_grid grid, const underling_problem problem)
Collectively find the maximum amount of per-processor memory required to handle the problem across al...
underling_problem_destroy
void underling_problem_destroy(underling_problem problem)
Destroy all resources associated with the given problem.
underling_extents::start
int start[4]
The inclusive global data starting offset in directions n{0,1,2}.
Definition: underling.h:85
underling_fprint_problem
void underling_fprint_problem(const underling_problem problem, FILE *output_file)
Dump an instance's internals in a debugging-friendly format.
underling_local_extents
underling_extents underling_local_extents(const underling_problem problem, int i)
Obtain the processor-local sizes, storage details, and global starting offsets when the data is long ...
UNDERLING_EXTENTS_INVALID
const underling_extents UNDERLING_EXTENTS_INVALID
A static instance used to communicate wholly invalid, unusable extents.
underling_local_memory_minimum
size_t underling_local_memory_minimum(const underling_grid grid, const underling_problem problem)
Collectively find the minimal amount of per-processor memory required to handle the problem across al...
underling_global_memory_optimum
size_t underling_global_memory_optimum(const underling_grid grid, const underling_problem problem)
Find the theoretical optimum (minimum) amount of memory required to store the given problem on all pr...
underling_extents::order
int order[4]
The storage order from the fastest index to the slowest.
Definition: underling.h:108
underling_real
double underling_real
The real-valued scalar type used throughout the library.
Definition: underling.h:63
underling_extents
A transparent type storing the local sizes, strides, and storage when the data is long in a particula...
Definition: underling.h:79
underling_execute_long_n0_to_long_n1
int underling_execute_long_n0_to_long_n1(const underling_plan plan, underling_real *in, underling_real *out)
Collectively transform data from being long in n0 within buffer in to being long in n1 within buffer ...
underling_execute_long_n1_to_long_n0
int underling_execute_long_n1_to_long_n0(const underling_plan plan, underling_real *in, underling_real *out)
Collectively transform data from being long in n1 within buffer in to being long in n0 within buffer ...
underling_plan_destroy
void underling_plan_destroy(underling_plan plan)
Destroy all resources associated with the given plan.
underling_extents_cmp
int underling_extents_cmp(const underling_extents *const e1, const underling_extents *const e2)
Compare two underling_extents instances using lexicographic ordering.
underling_problem
struct underling_problem_s * underling_problem
A type encapsulating all parallel decomposition information, including required local storage and str...
Definition: underling.h:352
underling_execute_long_n1_to_long_n2
int underling_execute_long_n1_to_long_n2(const underling_plan plan, underling_real *in, underling_real *out)
Collectively transform data from being long in n1 within buffer in to being long in n2 within buffer ...
underling_only_init
int underling_only_init(int *argc, char **argv[])
Initialize underling.
underling_global_memory
size_t underling_global_memory(const underling_grid grid, const underling_problem problem)
Collectively find the global amount of memory required to handle the problem across all processors in...
underling::extents
underling_extents extents
Definition: underling.hpp:44
underling_problem_create
underling_problem underling_problem_create(underling_grid grid, int howmany, unsigned transposed_flags)
Collectively create an instance encapsulating the parallel decomposition details for a decomposition ...
underling_plan_create
underling_plan underling_plan_create(const underling_problem problem, underling_real *in, underling_real *out, unsigned transpose_flags, unsigned fftw_rigor_flags)
Collectively create an execution plan to solve the given decomposition problem using the given input ...
underling_init
int underling_init(int *argc, char **argv[], int nthreads)
Initialize MPI (if necessary), FFTW threading, FFTW MPI, and underling.

Generated on Wed Jul 1 2026 13:22:57 for underling by  doxygen 1.8.17