Commit 64ad4686 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Change custom USING_OPENMP to standard _OPENMP

parent ee1c9505
......@@ -89,7 +89,6 @@ AC_ARG_ENABLE([openmp], [AS_HELP_STRING([--disable-openmp],[disable openmp [defa
[AX_OPENMP([], [USING_OPENMP=no]
[OPENMP_CXXFLAGS="-Wno-unknown-pragmas"])])
if test ${USING_OPENMP} = yes; then
AC_DEFINE([USING_OPENMP], 1, [using openmp])
dnl clang is retarded
if test "$(${CXX} --version | grep clang)x" != "x"; then
[OPENMP_LDFLAGS="-lomp ${OPENMP_LDFLAGS}"]
......
......@@ -23,7 +23,7 @@
#include "hash_map_wrap.hh"
#include <boost/mpl/if.hpp>
#ifdef USING_OPENMP
#ifdef _OPENMP
#include "omp.h"
#endif
......
......@@ -24,13 +24,13 @@ using namespace boost;
using namespace graph_tool;
// OpenMP control
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
bool openmp_enabled()
{
#ifdef USING_OPENMP
#ifdef _OPENMP
return true;
#else
return false;
......@@ -39,7 +39,7 @@ bool openmp_enabled()
size_t openmp_get_num_threads()
{
#ifdef USING_OPENMP
#ifdef _OPENMP
return omp_get_max_threads();
#else
throw GraphException("OpenMP was not enabled during compilation");
......@@ -48,7 +48,7 @@ size_t openmp_get_num_threads()
void openmp_set_num_threads(int n)
{
#ifdef USING_OPENMP
#ifdef _OPENMP
omp_set_num_threads(n);
#else
throw GraphException("OpenMP was not enabled during compilation");
......@@ -57,7 +57,7 @@ void openmp_set_num_threads(int n)
python::tuple openmp_get_schedule()
{
#ifdef USING_OPENMP
#ifdef _OPENMP
omp_sched_t kind;
int chunk;
omp_get_schedule(&kind, &chunk);
......@@ -88,7 +88,7 @@ python::tuple openmp_get_schedule()
void openmp_set_schedule(string skind, int chunk)
{
#ifdef USING_OPENMP
#ifdef _OPENMP
omp_sched_t kind;
if (skind == "static")
kind = omp_sched_static;
......
......@@ -22,7 +22,7 @@
#include "graph_selectors.hh"
#include "graph_util.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
......@@ -45,7 +45,7 @@ struct do_edge_endpoint
eprop_t eprop = any_cast<eprop_t>(aeprop);
eprop.reserve(edge_index_range);
#ifdef USING_OPENMP
#ifdef _OPENMP
size_t __attribute__ ((unused)) nt = omp_get_num_threads();
if (std::is_convertible<val_t,python::object>::value)
nt = 1; // python is not thread-safe
......
......@@ -22,7 +22,7 @@
#include "graph_selectors.hh"
#include "graph_util.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
......@@ -164,7 +164,7 @@ struct do_out_edges_op
auto vprop = boost::any_cast<VProp>(avprop).get_unchecked(num_vertices(g));
#ifdef USING_OPENMP
#ifdef _OPENMP
size_t __attribute__ ((unused)) nt = omp_get_num_threads();
if (std::is_convertible<eval_t,python::object>::value)
nt = 1; // python is not thread-safe
......
......@@ -27,7 +27,7 @@
#include "hash_map_wrap.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
namespace graph_tool
......
......@@ -28,7 +28,7 @@
#include "hash_map_wrap.hh"
#include "parallel_rng.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
namespace graph_tool
......
......@@ -28,7 +28,7 @@
#include "hash_map_wrap.hh"
#include "parallel_rng.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
namespace graph_tool
......
......@@ -28,7 +28,7 @@
#include "hash_map_wrap.hh"
#include "parallel_rng.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#endif
namespace graph_tool
......
......@@ -24,7 +24,7 @@ template <class RNG>
void init_rngs(std::vector<std::shared_ptr<RNG>>& rngs, RNG& rng)
{
size_t num_threads = 1;
#ifdef USING_OPENMP
#ifdef _OPENMP
num_threads = omp_get_max_threads();
#endif
for (size_t i = 0; i < num_threads; ++i)
......@@ -42,7 +42,7 @@ RNG& get_rng(std::vector<std::shared_ptr<RNG>>& rngs, RNG& rng)
if (rngs.empty())
return rng;
size_t tid = 0;
#ifdef USING_OPENMP
#ifdef _OPENMP
tid = omp_get_thread_num();
#endif
return *rngs[tid];
......
......@@ -22,7 +22,7 @@
#include "graph_util.hh"
#include "hash_map_wrap.hh"
#ifdef USING_OPENMP
#ifdef _OPENMP
#include <omp.h>
#include <boost/type_traits.hpp>
#endif
......@@ -68,7 +68,7 @@ struct find_vertices
range.first = python::extract<value_type>(prange[0]);
range.second = python::extract<value_type>(prange[1]);
#ifdef USING_OPENMP
#ifdef _OPENMP
size_t __attribute__ ((unused)) nt = omp_get_num_threads();
if (std::is_convertible<value_type,python::object>::value)
nt = 1; // python is not thread-safe
......@@ -112,7 +112,7 @@ struct find_edges
gt_hash_set<size_t> edge_set;
#ifdef USING_OPENMP
#ifdef _OPENMP
size_t __attribute__ ((unused)) nt = omp_get_num_threads();
if (std::is_convertible<value_type,python::object>::value)
nt = 1; // python is not thread-safe
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment