Skip to content

Commit 17a9ab3

Browse files
authored
Merge pull request #43 from bmerry/c++11
Use C++11
2 parents 5957fdd + ae63e84 commit 17a9ab3

22 files changed

+263
-334
lines changed

Changelog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Development version
2+
-------------------
3+
* Remove some uses of TR1/Boost in favour of C++11
4+
* Make C++11 mandatory
5+
16
1.5.1
27
-----
38
* Workaround for NVIDIA driver bug that prevents scan from autotuning on Pascal hardware

LICENSE

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Copyright (c) 2012-2013 University of Cape Town
1+
Copyright (c) 2012-2014 University of Cape Town
2+
Copyright (c) 2014-2018 Bruce Merry
23

34
Permission is hereby granted, free of charge, to any person obtaining a copy
45
of this software and associated documentation files (the "Software"), to deal

README

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ For the impatient, the process is
66
$ ./waf configure [ --prefix=install-path ]
77
$ ./waf build
88
$ sudo ./waf install
9-
$ clogs-tune
109

1110
which will build and install to the install path (defaults to /usr/local),
1211
and which will install the documentation in /usr/local/share/doc/clogs

doc/RELEASE-PROCESS

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
- On machines with 480 GTX and R9 270
77
- Install the new version
88
- rm -rf ~/.cache/clogs
9-
- clogs-tune --cl-gpu
109
- Run benchmark
1110
- Update clogs-benchmark-plot.sh with new version and run it
1211
- Add the new benchmarks to git

doc/clogs-user.xml

+16-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
33
<!--
44
Copyright (c) 2012-2014 University of Cape Town
5-
Copyright (c) 2014, 2015 Bruce Merry
5+
Copyright (c) 2014, 2015, 2018 Bruce Merry
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -39,6 +39,7 @@
3939
<copyright>
4040
<year>2014</year>
4141
<year>2015</year>
42+
<year>2018</year>
4243
<holder>Bruce Merry</holder>
4344
</copyright>
4445
<!-- The releaseinfo element is replaced by the stylesheet to inject
@@ -68,8 +69,11 @@
6869
<section id="installation.requirements">
6970
<title>Requirements</title>
7071
<para>
71-
At present CLOGS is only supported with GCC on GNU/Linux and
72-
with Visual C++ on Windows. The code for the library
72+
At present CLOGS is only supported with GCC and Clang on
73+
GNU/Linux. It has also been used with Visual C++ on Windows,
74+
but the author no longer has a Windows installation and so it
75+
is unknown if it still works (if it doesn't, you can submit a
76+
patch). The code for the library
7377
itself is portable, but some aspects of the build system and
7478
test suite require porting.
7579
</para>
@@ -98,8 +102,12 @@
98102
OpenCL version.
99103
</para></listitem>
100104
<listitem><para>
101-
A C++ compiler. GCC 4.8 and Visual C++ 2013 have been
102-
tested.
105+
A C++ compiler supporting C++11. GCC 4.8 and Visual C++
106+
2013 have been tested. The public interface does not
107+
rely on any C++11 features, so it might not be
108+
necessary to build against clogs in C++11 mode,
109+
although ABI changes in classes like std::string may
110+
cause issues.
103111
</para></listitem>
104112
<listitem><para>
105113
The Boost headers. No dynamic libraries are needed to
@@ -196,10 +204,6 @@
196204
the root of the filesystem. This is intended for use with
197205
package management tools.
198206
</para>
199-
<para>
200-
After installing, it is necessary to tune CLOGS for your OpenCL
201-
devices. See the next section for details.
202-
</para>
203207
</section>
204208
<section id="installation.tune">
205209
<title>Autotuning</title>
@@ -422,8 +426,8 @@ sorter.enqueue(queue, keys, values, numElements, 20, &amp;wait, &amp;event);
422426
<para>
423427
The algorithm objects are non-copyable, to avoid
424428
accidently triggering expensive copies of OpenCL objects.
425-
However, they are default-constructible, swappable, and (if a
426-
C++11 compiler is used) movable.
429+
However, they are default-constructible, swappable, and
430+
moveable.
427431
</para>
428432
</section>
429433
<section id="using.profile">
@@ -503,7 +507,7 @@ problem.setTunePolicy(policy);
503507
<title>License</title>
504508
<para>
505509
Copyright (c) 2012-2014 University of Cape Town
506-
Copyright (c) 2014 Bruce Merry
510+
Copyright (c) 2014, 2015, 2018 Bruce Merry
507511
</para>
508512
<para>
509513
Permission is hereby granted, free of charge, to any person obtaining a copy

src/parameters.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
#include <cstddef>
3939
#include <locale>
4040
#include <cassert>
41+
#include <type_traits>
4142
#include <boost/preprocessor.hpp>
42-
#include <boost/type_traits/is_integral.hpp>
43-
#include <boost/utility/enable_if.hpp>
4443
#include <clogs/visibility_pop.h>
4544

4645
#include <clogs/core.h>
@@ -83,7 +82,7 @@ CLOGS_LOCAL int readFields(sqlite3_stmt *stmt, int pos, std::vector<unsigned cha
8382

8483
/// @copydoc readFields(sqlite3_stmt *, int, std::string &)
8584
template<typename T>
86-
typename boost::enable_if<boost::is_integral<T>, int>::type
85+
typename std::enable_if<std::is_integral<T>::value, int>::type
8786
static inline readFields(sqlite3_stmt *stmt, int pos, T &value)
8887
{
8988
assert(pos >= 0 && pos < sqlite3_column_count(stmt));
@@ -130,7 +129,7 @@ static inline void fieldTypes(const std::vector<unsigned char> *, std::vector<co
130129

131130
/// @copydoc fieldTypes(const std::string *, std::vector<const char *> &)
132131
template<typename T>
133-
static inline typename boost::enable_if<boost::is_integral<T> >::type
132+
static inline typename std::enable_if<std::is_integral<T>::value>::type
134133
fieldTypes(const T *, std::vector<const char *> &out)
135134
{
136135
out.push_back("INT");

src/radixsort.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2012-2014 University of Cape Town
2-
* Copyright (c) 2014 Bruce Merry
2+
* Copyright (c) 2014, 2018 Bruce Merry
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -38,6 +38,8 @@
3838
#include <algorithm>
3939
#include <vector>
4040
#include <utility>
41+
#include <random>
42+
#include <functional>
4143
#include <clogs/visibility_pop.h>
4244

4345
#include <clogs/core.h>
@@ -47,8 +49,6 @@
4749
#include "parameters.h"
4850
#include "tune.h"
4951
#include "cache.h"
50-
#include "tr1_random.h"
51-
#include "tr1_functional.h"
5252

5353
namespace clogs
5454
{
@@ -459,7 +459,7 @@ static cl::Buffer makeRandomBuffer(const cl::CommandQueue &queue, ::size_t size)
459459
cl::Buffer buffer(queue.getInfo<CL_QUEUE_CONTEXT>(), CL_MEM_READ_WRITE, size);
460460
cl_uchar *data = reinterpret_cast<cl_uchar *>(
461461
queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, size));
462-
RANDOM_NAMESPACE::mt19937 engine;
462+
std::mt19937 engine;
463463
for (::size_t i = 0; i < size; i++)
464464
{
465465
/* We take values directly from the engine rather than using a
@@ -665,10 +665,10 @@ RadixsortParameters::Value Radixsort::tune(
665665
params.reduceWorkGroupSize = reduceWorkGroupSize;
666666
sets.push_back(params);
667667
}
668-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
668+
using namespace std::placeholders;
669669
cand = boost::any_cast<RadixsortParameters::Value>(tuneOne(
670670
policy, device, sets, problemSizes,
671-
FUNCTIONAL_NAMESPACE::bind(&Radixsort::tuneReduceCallback, _1, _2, _3, _4, problem)));
671+
std::bind(&Radixsort::tuneReduceCallback, _1, _2, _3, _4, problem)));
672672
}
673673

674674
// Tune the scatter kernel
@@ -687,10 +687,10 @@ RadixsortParameters::Value Radixsort::tune(
687687
sets.push_back(params);
688688
}
689689
}
690-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
690+
using namespace std::placeholders;
691691
cand = boost::any_cast<RadixsortParameters::Value>(tuneOne(
692692
policy, device, sets, problemSizes,
693-
FUNCTIONAL_NAMESPACE::bind(&Radixsort::tuneScatterCallback, _1, _2, _3, _4, problem)));
693+
std::bind(&Radixsort::tuneScatterCallback, _1, _2, _3, _4, problem)));
694694
}
695695

696696
// Tune the block count
@@ -729,10 +729,10 @@ RadixsortParameters::Value Radixsort::tune(
729729
sets.push_back(params);
730730
}
731731

732-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
732+
using namespace std::placeholders;
733733
cand = boost::any_cast<RadixsortParameters::Value>(tuneOne(
734734
policy, device, sets, problemSizes,
735-
FUNCTIONAL_NAMESPACE::bind(&Radixsort::tuneBlocksCallback, _1, _2, _3, _4, problem)));
735+
std::bind(&Radixsort::tuneBlocksCallback, _1, _2, _3, _4, problem)));
736736
}
737737

738738
// TODO: benchmark the whole combination

src/reduce.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2015 Bruce Merry
1+
/* Copyright (c) 2014, 2015, 2018 Bruce Merry
22
*
33
* Permission is hereby granted, free of charge, to any person obtaining a copy
44
* of this software and associated documentation files (the "Software"), to deal
@@ -176,10 +176,10 @@ ReduceParameters::Value Reduce::tune(
176176
sets.push_back(params);
177177
}
178178

179-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
179+
using namespace std::placeholders;
180180
cand = boost::any_cast<ReduceParameters::Value>(tuneOne(
181181
policy, device, sets, problemSizes,
182-
FUNCTIONAL_NAMESPACE::bind(&Reduce::tuneReduceCallback, _1, _2, _3, _4, problem)));
182+
std::bind(&Reduce::tuneReduceCallback, _1, _2, _3, _4, problem)));
183183
}
184184

185185
{
@@ -192,10 +192,10 @@ ReduceParameters::Value Reduce::tune(
192192
sets.push_back(params);
193193
}
194194

195-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
195+
using namespace std::placeholders;
196196
cand = boost::any_cast<ReduceParameters::Value>(tuneOne(
197197
policy, device, sets, problemSizes,
198-
FUNCTIONAL_NAMESPACE::bind(&Reduce::tuneReduceCallback, _1, _2, _3, _4, problem)));
198+
std::bind(&Reduce::tuneReduceCallback, _1, _2, _3, _4, problem)));
199199
}
200200

201201
policy.logEndAlgorithm();

src/scan.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Copyright (c) 2012-2014 University of Cape Town
2-
* Copyright (c) 2014 Bruce Merry
2+
* Copyright (c) 2014, 2018 Bruce Merry
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -286,10 +286,10 @@ ScanParameters::Value Scan::tune(
286286
sets.push_back(params);
287287
}
288288

289-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
289+
using namespace std::placeholders;
290290
ScanParameters::Value params = boost::any_cast<ScanParameters::Value>(tuneOne(
291291
policy, device, sets, problemSizes,
292-
FUNCTIONAL_NAMESPACE::bind(&Scan::tuneReduceCallback, _1, _2, _3, _4, problem)));
292+
std::bind(&Scan::tuneReduceCallback, _1, _2, _3, _4, problem)));
293293
bestReduceWorkGroupSize = params.reduceWorkGroupSize;
294294
}
295295

@@ -314,10 +314,10 @@ ScanParameters::Value Scan::tune(
314314
}
315315
}
316316

317-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
317+
using namespace std::placeholders;
318318
ScanParameters::Value params = boost::any_cast<ScanParameters::Value>(tuneOne(
319319
policy, device, sets, problemSizes,
320-
FUNCTIONAL_NAMESPACE::bind(&Scan::tuneScanCallback, _1, _2, _3, _4, problem)));
320+
std::bind(&Scan::tuneScanCallback, _1, _2, _3, _4, problem)));
321321
bestScanWorkGroupSize = params.scanWorkGroupSize;
322322
bestScanWorkScale = params.scanWorkScale;
323323
}
@@ -337,10 +337,10 @@ ScanParameters::Value Scan::tune(
337337
params.scanBlocks = blocks;
338338
sets.push_back(params);
339339
}
340-
using namespace FUNCTIONAL_NAMESPACE::placeholders;
340+
using namespace std::placeholders;
341341
ScanParameters::Value params = boost::any_cast<ScanParameters::Value>(tuneOne(
342342
policy, device, sets, problemSizes,
343-
FUNCTIONAL_NAMESPACE::bind(&Scan::tuneBlocksCallback, _1, _2, _3, _4, problem)));
343+
std::bind(&Scan::tuneBlocksCallback, _1, _2, _3, _4, problem)));
344344
bestBlocks = params.scanBlocks;
345345
}
346346

src/tr1_functional.h

-47
This file was deleted.

src/tr1_random.h

-47
This file was deleted.

0 commit comments

Comments
 (0)