Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'unstable' of github.com:Neverlord/libcppa into unstable

  • Loading branch information...
commit e1ffb3bf1fe6f0b0d59b0e8760491db739d7cd12 2 parents 73bc488 + 65431a5
@Neverlord Neverlord authored
View
2  cppa/option.hpp
@@ -63,7 +63,7 @@ class option {
option(T value) : m_valid(false) { cr(std::move(value)); }
template<typename T0, typename T1, typename... Ts>
- option(T0&& arg0, T1&& arg1, Ts&&... args) {
+ option(T0&& arg0, T1&& arg1, Ts&&... args) : m_valid(false) {
cr(T(std::forward<T0>(arg0),
std::forward<T1>(arg1),
std::forward<Ts>(args)...));
View
14 examples/opencl/proper_matrix.cpp
@@ -86,12 +86,12 @@ class square_matrix {
}
- inline float& operator()(size_t row, size_t column) {
- return m_data[row + column * Size];
+ inline float& operator()(size_t column, size_t row) {
+ return m_data[column + row * Size];
}
- inline const float& operator()(size_t row, size_t column) const {
- return m_data[row + column * Size];
+ inline const float& operator()(size_t column, size_t row) const {
+ return m_data[column + row * Size];
}
inline void iota_fill() {
@@ -118,9 +118,9 @@ template<size_t Size>
string to_string(const square_matrix<Size>& m) {
ostringstream oss;
oss.fill(' ');
- for (size_t column = 0; column < Size; ++column) {
- for (size_t row = 0; row < Size; ++row) {
- oss << fixed << setprecision(2) << setw(9) << m(row, column);
+ for (size_t row = 0; row < Size; ++row) {
+ for (size_t column = 0; column < Size; ++column) {
+ oss << fixed << setprecision(2) << setw(9) << m(column, row);
}
oss << '\n';
}
View
18 src/opencl/command_dispatcher.cpp
@@ -122,18 +122,28 @@ void command_dispatcher::initialize() {
cl_int err{0};
/* find up to two available platforms */
- vector<cl_platform_id> ids(2);
cl_uint number_of_platforms;
- err = clGetPlatformIDs(ids.size(), ids.data(), &number_of_platforms);
+ err = clGetPlatformIDs(0, nullptr, &number_of_platforms);
if (err != CL_SUCCESS) {
ostringstream oss;
- oss << "clGetPlatformIDs: " << get_opencl_error(err);
+ oss << "clGetPlatformIDs (getting number of platforms): "
+ << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw logic_error(oss.str());
}
else if (number_of_platforms < 1) {
ostringstream oss;
- oss << "clGetPlatformIDs: 'no platforms found'.";
+ oss << "clGetPlatformIDs: no platforms found.";
+ CPPA_LOGMF(CPPA_ERROR, self, oss.str());
+ throw logic_error(oss.str());
+ }
+
+ vector<cl_platform_id> ids(number_of_platforms);
+ err = clGetPlatformIDs(ids.size(), ids.data(), nullptr);
+ if (err != CL_SUCCESS) {
+ ostringstream oss;
+ oss << "clGetPlatformIDs (getting platform ids): "
+ << get_opencl_error(err);
CPPA_LOGMF(CPPA_ERROR, self, oss.str());
throw logic_error(oss.str());
}
View
10 unit_testing/test_opencl.cpp
@@ -30,7 +30,7 @@ constexpr const char* kernel_source = R"__(
for (size_t idx = 0; idx < size; ++idx) {
result += matrix[idx + y * size] * matrix[x + idx * size];
}
- output[x+y*size] = result;
+ output[x + y * size] = result;
}
)__";
@@ -54,12 +54,12 @@ class square_matrix {
assert(m_data.size() == num_elements);
}
- inline float& operator()(size_t row, size_t column) {
- return m_data[row + column * Size];
+ inline float& operator()(size_t column, size_t row) {
+ return m_data[column + row * Size];
}
- inline const float& operator()(size_t row, size_t column) const {
- return m_data[row + column * Size];
+ inline const float& operator()(size_t column, size_t row) const {
+ return m_data[column + row * Size];
}
inline void iota_fill() {
Please sign in to comment.
Something went wrong with that request. Please try again.