Skip to content

Commit

Permalink
Merge pull request #1549 from STEllAR-GROUP/fixing_intel14
Browse files Browse the repository at this point in the history
Fixing intel14/libstdc++4.4
  • Loading branch information
hkaiser committed May 26, 2015
2 parents 2bdf6a5 + 50a6183 commit 1f9ba33
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 77 deletions.
7 changes: 7 additions & 0 deletions cmake/HPX_SetupBoost.cmake
Expand Up @@ -90,6 +90,13 @@ else()
set(Boost_TMP_LIBRARIES ${Boost_TMP_LIBRARIES} ${Boost_LIBRARIES})
endif()

# attempt to load Boost.Random (if available), it's needed for one example only
find_package(Boost 1.49 QUIET COMPONENTS random)
if(Boost_RANDOM_FOUND)
hpx_info(" random")
set(Boost_TMP_LIBRARIES ${Boost_TMP_LIBRARIES} ${Boost_LIBRARIES})
endif()

# If the found Boost installation is < 1.57, we need to include extra
# serialization headers
if(Boost_VERSION LESS 105700)
Expand Down
6 changes: 4 additions & 2 deletions examples/1d_stencil/1d_stencil_1_omp.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2014 Hartmut Kaiser
// Copyright (c) 2014-2015 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -12,6 +12,8 @@
// The only difference to 1d_stencil_1 is that this example uses OpenMP for
// parallelizing the inner loop.

#include <hpx/config.hpp> // avoid issues with Intel14/libstdc++4.4 nullptr

#include <boost/cstdint.hpp>
#include <boost/program_options.hpp>
#include <boost/chrono.hpp>
Expand Down Expand Up @@ -91,7 +93,7 @@ int hpx_main(boost::program_options::variables_map& vm)
{
boost::uint64_t nx = vm["nx"].as<boost::uint64_t>(); // Number of grid points.
boost::uint64_t nt = vm["nt"].as<boost::uint64_t>(); // Number of steps.

if (vm.count("no-header"))
header = false;

Expand Down
7 changes: 5 additions & 2 deletions examples/1d_stencil/1d_stencil_3_omp.cpp
@@ -1,4 +1,4 @@
// Copyright (c) 2014 Hartmut Kaiser
// Copyright (c) 2014-2015 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -14,6 +14,8 @@
// The only difference to 1d_stencil_3 is that this example uses OpenMP for
// parallelizing the inner loop.

#include <hpx/config.hpp> // avoid issues with Intel14/libstdc++4.4 nullptr

#include <boost/cstdint.hpp>
#include <boost/program_options.hpp>
#include <boost/chrono.hpp>
Expand All @@ -24,6 +26,7 @@
#include <omp.h>

#include "print_time_results.hpp"

///////////////////////////////////////////////////////////////////////////////
// Timer with nanosecond resolution
inline boost::uint64_t now()
Expand Down Expand Up @@ -153,7 +156,7 @@ int hpx_main(boost::program_options::variables_map& vm)
boost::uint64_t np = vm["np"].as<boost::uint64_t>(); // Number of partitions.
boost::uint64_t nx = vm["nx"].as<boost::uint64_t>(); // Number of grid points.
boost::uint64_t nt = vm["nt"].as<boost::uint64_t>(); // Number of steps.

if (vm.count("no-header"))
header = false;

Expand Down
2 changes: 1 addition & 1 deletion examples/future_reduce/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@
set(example_programs
)

if(HPX_WITH_CXX11_LAMBDAS)
if(Boost_RANDOM_FOUND AND HPX_WITH_CXX11_LAMBDAS)
set(example_programs
${example_programs}
future_reduce)
Expand Down
12 changes: 8 additions & 4 deletions examples/future_reduce/future_reduce.cpp
Expand Up @@ -10,6 +10,10 @@
//
#include <random>

#include <boost/nondet_random.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>

//
// This is a simple example which generates random numbers and returns
// pass or fail from a routine.
Expand All @@ -18,7 +22,7 @@
// any fail = !pass rule, then this example shows how to do it.
// The user can experiment with the failure rate to see if the statistics match
// their expectations.
// Also. Routine can use either a lamda, or a function under control of USE_LAMBDA
// Also. Routine can use either a lambda, or a function under control of USE_LAMBDA

#define TEST_SUCCESS 1
#define TEST_FAIL 0
Expand All @@ -27,9 +31,9 @@
#define SAMPLES_PER_LOOP 10
#define TEST_LOOPS 1000
//
std::random_device rseed;
std::mt19937 gen(rseed());
std::uniform_int_distribution<int> dist(0,99); // interval [0,100)
boost::random::random_device rseed;
boost::random::mt19937 gen(rseed());
boost::random::uniform_int_distribution<int> dist(0,99); // interval [0,100)

#define USE_LAMBDA

Expand Down
4 changes: 2 additions & 2 deletions examples/jacobi_smp/jacobi_nonuniform_omp.hpp
Expand Up @@ -4,12 +4,12 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include "jacobi_nonuniform.hpp"

#include <hpx/util/high_resolution_timer.hpp>

#include <boost/shared_ptr.hpp>

#include "jacobi_nonuniform.hpp"

#include <vector>
#include <string>

Expand Down
4 changes: 1 addition & 3 deletions examples/jacobi_smp/jacobi_omp.hpp
Expand Up @@ -4,12 +4,10 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include "jacobi.hpp"

#include <hpx/util/high_resolution_timer.hpp>

#include <boost/shared_ptr.hpp>

#include "jacobi.hpp"
#include <vector>
#include <string>

Expand Down
6 changes: 3 additions & 3 deletions examples/quickstart/pipeline1.cpp
Expand Up @@ -9,10 +9,10 @@
#include <iostream>
#include <string>
#include <vector>
#include <regex>

#include <boost/algorithm/string/trim.hpp>
#include <boost/range/functions.hpp>
#include <boost/regex.hpp>

struct pipeline
{
Expand All @@ -21,8 +21,8 @@ struct pipeline
// job for first stage
auto grep = [](std::string const& re, std::string const& item)
{
std::regex regex(re);
if (std::regex_match(item, regex))
boost::regex regex(re);
if (boost::regex_match(item, regex))
{
auto trim = [](std::string const& s)
{
Expand Down
5 changes: 3 additions & 2 deletions examples/transpose/transpose.cpp
Expand Up @@ -282,7 +282,7 @@ int hpx_main(boost::program_options::variables_map& vm)

auto range = boost::irange(blocks_start, blocks_end);

std::vector<hpx::future<void> > block_futures;
std::vector<hpx::shared_future<void> > block_futures;
block_futures.resize(num_local_blocks);

for_each(par, boost::begin(range), boost::end(range),
Expand All @@ -309,7 +309,8 @@ int hpx_main(boost::program_options::variables_map& vm)
);
}

block_futures[b - blocks_start] = hpx::when_all(phase_futures);
block_futures[b - blocks_start] =
hpx::when_all(phase_futures).share();
}
);

Expand Down
4 changes: 2 additions & 2 deletions examples/transpose/transpose_smp_block.cpp
Expand Up @@ -94,7 +94,7 @@ int hpx_main(boost::program_options::variables_map& vm)

auto range = boost::irange(start, num_blocks);

std::vector<hpx::future<void> > transpose_futures;
std::vector<hpx::shared_future<void> > transpose_futures;
transpose_futures.resize(num_blocks);

for_each(par, boost::begin(range), boost::end(range),
Expand All @@ -113,7 +113,7 @@ int hpx_main(boost::program_options::variables_map& vm)
transpose(&A[from_block][A_offset], &B[b][B_offset],
block_order, tile_size);
}
);
).share();
}
);

Expand Down
4 changes: 0 additions & 4 deletions hpx/config/compiler_specific.hpp
Expand Up @@ -46,10 +46,6 @@

#endif

#if defined(HPX_INTEL_VERSION) && HPX_INTEL_VERSION == 1400
# define HPX_INTEL14_WORKAROUND
#endif

// Identify if we compile for the MIC
#if defined(__MIC)
# define HPX_NATIVE_MIC
Expand Down
39 changes: 0 additions & 39 deletions hpx/util/detail/unique_function_template.hpp
Expand Up @@ -129,20 +129,7 @@ namespace hpx { namespace util
typedef detail::unique_function_vtable_ptr<Sig, IArchive, OArchive> vtable_ptr;
typedef detail::basic_function<vtable_ptr, Sig> base_type;

#if defined(HPX_INTEL14_WORKAROUND)
private:
unique_function& operator=(unique_function const&);

public:
// The Intel Compiler sometimes erroneously instantiates this ctor. In order
// to avoid compile errors, we provide the definition here
unique_function(unique_function const & other) BOOST_NOEXCEPT
{
HPX_ASSERT(false);
}
#else
HPX_MOVABLE_BUT_NOT_COPYABLE(unique_function);
#endif

public:
typedef typename base_type::result_type result_type;
Expand Down Expand Up @@ -232,20 +219,7 @@ namespace hpx { namespace util
typedef detail::unique_function_vtable_ptr<Sig, void, void> vtable_ptr;
typedef detail::basic_function<vtable_ptr, Sig> base_type;

#if defined(HPX_INTEL14_WORKAROUND)
private:
unique_function& operator=(unique_function const&);

public:
// The Intel Compiler sometimes erroneously instantiates this ctor. In order
// to avoid compile errors, we provide the definition here
unique_function(unique_function const & other) BOOST_NOEXCEPT
{
HPX_ASSERT(false);
}
#else
HPX_MOVABLE_BUT_NOT_COPYABLE(unique_function);
#endif

public:
typedef typename base_type::result_type result_type;
Expand Down Expand Up @@ -309,20 +283,7 @@ namespace hpx { namespace util
{
typedef unique_function<Sig, void, void> base_type;

#if defined(HPX_INTEL14_WORKAROUND)
private:
unique_function_nonser& operator=(unique_function_nonser const&);

public:
// The Intel Compiler sometimes erroneously instantiates this ctor. In order
// to avoid compile errors, we provide the definition here
unique_function_nonser(unique_function_nonser const & other) BOOST_NOEXCEPT
{
HPX_ASSERT(false);
}
#else
HPX_MOVABLE_BUT_NOT_COPYABLE(unique_function_nonser);
#endif

public:
unique_function_nonser() BOOST_NOEXCEPT
Expand Down
3 changes: 2 additions & 1 deletion hpx/util/high_resolution_clock.hpp
@@ -1,11 +1,12 @@
// Copyright (c) 2007-2012 Hartmut Kaiser
// Copyright (c) 2007-2015 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#if !defined(HPX_HIGH_RESOLUTION_CLOCK_FEB_24_2012_1125AM)
#define HPX_HIGH_RESOLUTION_CLOCK_FEB_24_2012_1125AM

#include <hpx/config.hpp>
#include <boost/cstdint.hpp>

#if defined(__bgq__)
Expand Down
3 changes: 2 additions & 1 deletion hpx/util/high_resolution_timer.hpp
@@ -1,11 +1,12 @@
// Copyright (c) 2005-2012 Hartmut Kaiser
// Copyright (c) 2005-2015 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#if !defined(HPX_UTIL_HIGH_RESOLUTION_TIMER_MAR_24_2008_1222PM)
#define HPX_UTIL_HIGH_RESOLUTION_TIMER_MAR_24_2008_1222PM

#include <hpx/config.hpp>
#include <hpx/util/high_resolution_clock.hpp>

#include <boost/cstdint.hpp>
Expand Down
2 changes: 1 addition & 1 deletion hpx/util/move.hpp
Expand Up @@ -16,7 +16,7 @@

#include <utility>

#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
#if !defined(HPX_HAVE_CXX11_DELETED_FUNCTIONS)
#define HPX_MOVABLE_BUT_NOT_COPYABLE(TYPE) \
private: \
TYPE(TYPE const &); \
Expand Down
4 changes: 2 additions & 2 deletions tests/performance/local/foreach_scaling.cpp
Expand Up @@ -100,7 +100,7 @@ boost::uint64_t average_out_task(std::size_t vector_size)
return (hpx::util::high_resolution_clock::now() - start) / test_count;
}

std::vector<hpx::future<void> > tests;
std::vector<hpx::shared_future<void> > tests;
tests.resize(num_overlapping_loops);

boost::uint64_t start = hpx::util::high_resolution_clock::now();
Expand All @@ -110,7 +110,7 @@ boost::uint64_t average_out_task(std::size_t vector_size)
hpx::future<void> curr = measure_task_foreach(vector_size);
if (i >= num_overlapping_loops)
tests[(i-num_overlapping_loops) % tests.size()].wait();
tests[i % tests.size()] = std::move(curr);
tests[i % tests.size()] = curr.share();
}

hpx::wait_all(tests);
Expand Down
2 changes: 2 additions & 0 deletions tests/performance/local/htts_v2/htts2.hpp
Expand Up @@ -6,6 +6,8 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <hpx/config.hpp> // avoid issues with Intel14/libstdc++4.4 nullptr

#include <iostream>
#include <boost/format.hpp>

Expand Down

0 comments on commit 1f9ba33

Please sign in to comment.