#include "smalloc.h"
#include "vec.h"
#include "geminate.h"
-#include "gmx_omp.h"
+#include "gromacs/utility/gmxomp.h"
/* The first few sections of this file contain functions that were adopted,
* and to some extent modified, by Erik Marklund (erikm[aT]xray.bmc.uu.se,
/*#define HAVE_NN_LOOPS*/
-#include "gmx_omp.h"
-
#include "statutil.h"
#include "copyrite.h"
#include "sysstuff.h"
#include "txtdump.h"
-#include "gromacs/fileio/futil.h"
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/fileio/trxio.h"
#include "physics.h"
#include "macros.h"
#include "gmx_fatal.h"
#include "vec.h"
#include "xvgr.h"
#include "gstat.h"
-#include "gromacs/fileio/matio.h"
#include "string2.h"
#include "pbc.h"
#include "correl.h"
#include "gmx_ana.h"
#include "geminate.h"
+#include "gromacs/fileio/futil.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/utility/gmxomp.h"
+
typedef short int t_E;
typedef int t_EEst;
#define max_hx 7
#include "pbc.h"
#include "xvgr.h"
#include "copyrite.h"
-#include "gromacs/fileio/futil.h"
#include "statutil.h"
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/fileio/trxio.h"
#include "index.h"
#include "gstat.h"
-#include "gromacs/fileio/matio.h"
#include "gmx_ana.h"
#include "nsfactor.h"
-#include "gmx_omp.h"
+
+#include "gromacs/fileio/futil.h"
+#include "gromacs/fileio/matio.h"
+#include "gromacs/fileio/tpxio.h"
+#include "gromacs/fileio/trxio.h"
+#include "gromacs/utility/gmxomp.h"
int gmx_sans(int argc, char *argv[])
{
#include <ctype.h>
#include <string.h>
-#include "gromacs/fileio/futil.h"
#include "gmx_random.h"
#include "smalloc.h"
#include "sysstuff.h"
#include "strdb.h"
#include "vec.h"
#include "nsfactor.h"
-#include "gmx_omp.h"
+
+#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/gmxomp.h"
void check_binwidth(real binwidth)
{
#include "macros.h"
#include "network.h"
#include "statutil.h"
-#include "gmx_omp.h"
#include "gmx_omp_nthreads.h"
#include "md_logging.h"
+#include "gromacs/utility/gmxomp.h"
+
/** Structure with the number of threads for each OpenMP multi-threaded
* algorithmic module in mdrun. */
typedef struct
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "types/commrec.h"
#include "types/hw_info.h"
#include "gmx_cpuid.h"
-#include "gmx_omp.h"
#include "gmx_omp_nthreads.h"
#include "md_logging.h"
#include "statutil.h"
#include "gmx_thread_affinity.h"
#include "thread_mpi/threads.h"
-
+#include "gromacs/utility/gmxomp.h"
static int
get_thread_affinity_layout(FILE *fplog,
+++ /dev/null
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * Written by the Gromacs development team under coordination of
- * David van der Spoel, Berk Hess, and Erik Lindahl.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org
- *
- * And Hey:
- * GROup of MAchos and Cynical Suckers
- */
-
-#ifndef GMX_OMP_H
-#define GMX_OMP_H
-
-#include "types/commrec.h"
-#include "mdrun.h"
-
-/* This module defines wrappers for OpenMP API functions and enables compiling
- * code even when OpenMP is turned off in the build system.
- * Therefore, OpenMP API functions should always be used through these wrappers
- * and omp.h should never be directly included. Instead, this header should be
- * used whenever OpenMP API functions are needed.
- */
-
-/*! Returns an integer equal to or greater than the number of threads
- * that would be available if a parallel region without num_threads were
- * defined at that point in the code. Acts as a wrapper for omp_set_num_threads(void). */
-int gmx_omp_get_max_threads(void);
-
-/*! Returns the number of processors available when the function is called.
- * Acts as a wrapper around omp_get_num_procs() */
-int gmx_omp_get_num_procs(void);
-
-/*! Returns the thread number of the thread executing within its thread team.
- * Acts as a wrapper for omp_get_thread_num(void). */
-int gmx_omp_get_thread_num(void);
-
-/*! Sets the number of threads in subsequent parallel regions, unless overridden
- * by a num_threads clause. Acts as a wrapper for omp_get_max_threads(void). */
-void gmx_omp_set_num_threads(int num_threads);
-
-/*! Check for externally set thread affinity to avoid conflicts with GROMACS internal setting. */
-void gmx_omp_check_thread_affinity(FILE *fplog, const t_commrec *cr,
- gmx_hw_opt_t *hw_opt);
-
-#endif /* GMX_OMP_H */
#include "domdec.h"
#include "partdec.h"
#include "mtop_util.h"
-#include "gromacs/fileio/gmxfio.h"
#include "gmx_omp_nthreads.h"
-#include "gmx_omp.h"
+
+#include "gromacs/fileio/gmxfio.h"
+#include "gromacs/utility/gmxomp.h"
typedef struct {
int b0; /* first constraint for this thread */
#include "network.h"
#include "physics.h"
#include "nrnb.h"
-#include "gmx_omp.h"
#include "macros.h"
#include "gromacs/fft/parallel_3dfft.h"
#include "gromacs/timing/cyclecounter.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/gmxomp.h"
/* Include the SIMD macro file and then check for support */
#include "gmx_simd_macros.h"
/* Masks for 4-wide SIMD aligned spreading and gathering */
gmx_simd4_pb mask_S0[6], mask_S1[6];
#else
- int dummy; /* C89 requires that struct has at least one member */
+ int dummy; /* C89 requires that struct has at least one member */
#endif
} pme_spline_work_t;
#include "disre.h"
#include "orires.h"
#include "gmx_omp_nthreads.h"
-#include "gmx_omp.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/futil.h"
#include "gromacs/timing/wallcycle.h"
+#include "gromacs/utility/gmxomp.h"
/*For debugging, start at v(-dt/2) for velolcity verlet -- uncomment next line */
/*#define STARTFROMDT2*/
}
static void do_update_sd2_Tconsts(gmx_stochd_t *sd,
- int ngtc,
- const real tau_t[],
- const real ref_t[])
+ int ngtc,
+ const real tau_t[],
+ const real ref_t[])
{
/* This is separated from the update below, because it is single threaded */
gmx_sd_const_t *sdc;
#include "partdec.h"
#include "mtop_util.h"
#include "gmx_omp_nthreads.h"
-#include "gmx_omp.h"
+
+#include "gromacs/utility/gmxomp.h"
/* Routines to send/recieve coordinates and force
* of constructing atoms.
*
* \if libapi
*
- * The header gmxmpi.h abstract away the mechanism of including either MPI or
+ * The header gmxmpi.h abstracts away the mechanism of including either MPI or
* thread-MPI headers depending on compilation options.
+ * Similarly, gmxomp.h removes the need to use conditional compilation for code
+ * that needs to include omp.h for OpenMP functions.
*
* The header gmxregex.h declares gmx::Regex and regexMatch() for basic regular
* expression matching using an interface similar to C++11.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-file(GLOB UTILITY_SOURCES *.cpp)
+file(GLOB UTILITY_SOURCES *.c *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
set(GENERATED_HEADER_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/gmx_header_config_gen.h)
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
+ * This file is part of the GROMACS molecular simulation package.
*
+ * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
*
- * This source code is part of
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
*
- * G R O M A C S
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * GROningen MAchine for Chemical Simulations
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Written by the Gromacs development team under coordination of
- * David van der Spoel, Berk Hess, and Erik Lindahl.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Implements functions from gmxomp.h.
*
- * And Hey:
- * Gnomes, ROck Monsters And Chili Sauce
+ * \ingroup module_utility
*/
+#include "gromacs/utility/gmxomp.h"
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#ifdef GMX_OPENMP
#include <omp.h>
#include "gmx_fatal.h"
#include "statutil.h"
#include "string2.h"
-#include "gmx_omp.h"
int gmx_omp_get_max_threads(void)
{
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \libinternal \file
+ * \brief
+ * Declares OpenMP wrappers to avoid conditional compilation.
+ *
+ * This module defines wrappers for OpenMP API functions and enables compiling
+ * code without conditional compilation even when OpenMP is turned off in the
+ * build system.
+ * Therefore, OpenMP API functions should always be used through these wrappers
+ * and omp.h should never be directly included. Instead, this header should be
+ * used whenever OpenMP API functions are needed.
+ *
+ * \ingroup module_utility
+ */
+#ifndef GMX_UTILITY_OMP_H
+#define GMX_UTILITY_OMP_H
+
+#include "types/commrec.h"
+#include "mdrun.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*! \addtogroup module_utility
+ * \{
+ */
+
+/*! \brief
+ * Returns an integer equal to or greater than the number of threads
+ * that would be available if a parallel region without num_threads were
+ * defined at that point in the code.
+ *
+ * Acts as a wrapper for omp_get_max_threads().
+ */
+int gmx_omp_get_max_threads(void);
+
+/*! \brief
+ * Returns the number of processors available when the function is called.
+ *
+ * Acts as a wrapper around omp_get_num_procs().
+ */
+int gmx_omp_get_num_procs(void);
+
+/*! \brief
+ * Returns the thread number of the thread executing within its thread team.
+ *
+ * Acts as a wrapper for omp_get_thread_num().
+ */
+int gmx_omp_get_thread_num(void);
+
+/*! \brief
+ * Sets the number of threads in subsequent parallel regions, unless overridden
+ * by a num_threads clause.
+ *
+ * Acts as a wrapper for omp_set_num_threads().
+ */
+void gmx_omp_set_num_threads(int num_threads);
+
+/*! \brief
+ * Check for externally set thread affinity to avoid conflicts with \Gromacs
+ * internal setting.
+ */
+void gmx_omp_check_thread_affinity(FILE *fplog, const t_commrec *cr,
+ gmx_hw_opt_t *hw_opt);
+
+/*! \} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
#include "gmx_fatal_collective.h"
#include "membed.h"
#include "macros.h"
-#include "gmx_omp.h"
#include "gmx_thread_affinity.h"
#include "gromacs/fileio/tpxio.h"
#include "gromacs/mdlib/nbnxn_consts.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/gmxomp.h"
#ifdef GMX_FAHCORE
#include "corewrap.h"
{
gmx_barrier(cr);
}
-#endif /* GMX_THREAD_MPI */
+#endif /* GMX_THREAD_MPI */
/* uninitialize GPU (by destroying the context) */
if (!free_gpu(gpu_err_str))