1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
10 * Written by the Gromacs development team under coordination of
11 * David van der Spoel, Berk Hess, and Erik Lindahl.
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.
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
22 * GROup of MAchos and Cynical Suckers
27 #include "visibility.h"
28 #include "types/commrec.h"
31 /* This module defines wrappers for OpenMP API functions and enables compiling
32 * code even when OpenMP is turned off in the build system.
33 * Therefore, OpenMP API functions should always be used through these wrappers
34 * and omp.h should never be directly included. Instead, this header should be
35 * used whenever OpenMP API functions are needed.
38 /*! Returns an integer equal to or greater than the number of threads
39 * that would be available if a parallel region without num_threads were
40 * defined at that point in the code. Acts as a wrapper for omp_set_num_threads(void). */
42 int gmx_omp_get_max_threads(void);
44 /*! Returns the number of processors available when the function is called.
45 * Acts as a wrapper around omp_get_num_procs() */
46 int gmx_omp_get_num_procs(void);
48 /*! Returns the thread number of the thread executing within its thread team.
49 * Acts as a wrapper for omp_get_thread_num(void). */
51 int gmx_omp_get_thread_num(void);
53 /*! Sets the number of threads in subsequent parallel regions, unless overridden
54 * by a num_threads clause. Acts as a wrapper for omp_get_max_threads(void). */
56 void gmx_omp_set_num_threads(int num_threads);
58 /*! Check for externally set thread affinity to avoid conflicts with GROMACS internal setting. */
60 void gmx_omp_check_thread_affinity(FILE *fplog, const t_commrec *cr,
61 gmx_hw_opt_t *hw_opt);
63 #endif /* GMX_OMP_H */