[compute] 43/46: Fix incorrect count (global work size) update in generate methods
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Dec 21 18:28:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository compute.
commit d2d62f9973f0d192e35f7abd4705abf91f8c4433
Author: Jakub Szuppe <j.szuppe at gmail.com>
Date: Fri Dec 18 21:19:50 2015 +0100
Fix incorrect count (global work size) update in generate methods
---
include/boost/compute/random/linear_congruential_engine.hpp | 4 +++-
include/boost/compute/random/mersenne_twister_engine.hpp | 4 +++-
include/boost/compute/random/threefry_engine.hpp | 6 ++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/include/boost/compute/random/linear_congruential_engine.hpp b/include/boost/compute/random/linear_congruential_engine.hpp
index 492683e..ad89a95 100644
--- a/include/boost/compute/random/linear_congruential_engine.hpp
+++ b/include/boost/compute/random/linear_congruential_engine.hpp
@@ -11,6 +11,8 @@
#ifndef BOOST_COMPUTE_RANDOM_LINEAR_CONGRUENTIAL_ENGINE_HPP
#define BOOST_COMPUTE_RANDOM_LINEAR_CONGRUENTIAL_ENGINE_HPP
+#include <algorithm>
+
#include <boost/compute/types.hpp>
#include <boost/compute/buffer.hpp>
#include <boost/compute/kernel.hpp>
@@ -118,7 +120,7 @@ public:
for(;;){
size_t count = 0;
if(size > threads){
- count = threads;
+ count = (std::min)(static_cast<size_t>(threads), size - offset);
}
else {
count = size;
diff --git a/include/boost/compute/random/mersenne_twister_engine.hpp b/include/boost/compute/random/mersenne_twister_engine.hpp
index 9e2861b..df328c8 100644
--- a/include/boost/compute/random/mersenne_twister_engine.hpp
+++ b/include/boost/compute/random/mersenne_twister_engine.hpp
@@ -11,6 +11,8 @@
#ifndef BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP
#define BOOST_COMPUTE_RANDOM_MERSENNE_TWISTER_ENGINE_HPP
+#include <algorithm>
+
#include <boost/compute/types.hpp>
#include <boost/compute/buffer.hpp>
#include <boost/compute/kernel.hpp>
@@ -111,7 +113,7 @@ public:
for(;;){
size_t count = 0;
if(size > n){
- count = n;
+ count = (std::min)(static_cast<size_t>(n), size - offset);
}
else {
count = size;
diff --git a/include/boost/compute/random/threefry_engine.hpp b/include/boost/compute/random/threefry_engine.hpp
index 5e54322..917bb72 100644
--- a/include/boost/compute/random/threefry_engine.hpp
+++ b/include/boost/compute/random/threefry_engine.hpp
@@ -11,6 +11,8 @@
#ifndef BOOST_COMPUTE_RANDOM_THREEFRY_HPP
#define BOOST_COMPUTE_RANDOM_THREEFRY_HPP
+#include <algorithm>
+
#include <boost/compute/types.hpp>
#include <boost/compute/buffer.hpp>
#include <boost/compute/kernel.hpp>
@@ -247,7 +249,7 @@ public:
size_t count = 0;
size_t size = size_ctr/2;
if(size > threads){
- count = threads;
+ count = (std::min)(static_cast<size_t>(threads), size - offset);
}
else {
count = size;
@@ -282,7 +284,7 @@ public:
size_t count = 0;
size_t size = size_ctr/2;
if(size > threads){
- count = threads;
+ count = (std::min)(static_cast<size_t>(threads), size - offset);
}
else {
count = size;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/compute.git
More information about the debian-science-commits
mailing list