de55a43bf57315d75c8b386af00074c034702a5d
[alexxy/gromacs.git] / include / gmx_omp.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  *
4  *                This source code is part of
5  *
6  *                 G   R   O   M   A   C   S
7  *
8  *          GROningen MAchine for Chemical Simulations
9  *
10  * Written by the Gromacs development team under coordination of
11  * David van der Spoel, Berk Hess, and Erik Lindahl.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * To help us fund GROMACS development, we humbly ask that you cite
19  * the research papers on the package. Check out http://www.gromacs.org
20  *
21  * And Hey:
22  * GROup of MAchos and Cynical Suckers
23  */
24
25 #ifndef GMX_OMP_H
26 #define GMX_OMP_H
27
28 /* This module defines wrappers for OpenMP API functions and enables compiling
29  * code even when OpenMP is turned off in the build system.
30  * Therefore, OpenMP API functions should always be used through these wrappers
31  * and omp.h should never be directly included. Instead, this header should be
32  * used whenever OpenMP API functions are needed.
33  */
34
35 /*! Returns an integer equal to or greater than the number of threads
36  *  that would be available if a parallel region without num_threads were
37  *  defined at that point in the code. Acts as a wrapper for omp_set_num_threads(void). */
38 int  gmx_omp_get_max_threads(void);
39
40 /*! Returns the number of processors available when the function is called.
41  *  Acts as a wrapper around omp_get_num_procs() */
42 int gmx_omp_get_num_procs(void);
43
44 /*! Returns the thread number of the thread executing within its thread team.
45  *  Acts as a wrapper for omp_get_thread_num(void). */
46 int  gmx_omp_get_thread_num(void);
47
48 /*! Sets the number of threads in subsequent parallel regions, unless overridden
49  *  by a num_threads clause. Acts as a wrapper for omp_get_max_threads(void). */
50 void gmx_omp_set_num_threads(int num_threads);
51
52 #endif /* GMX_OMP_H */