diff --git a/gpu-opt/main.cu b/gpu-opt/main.cu index 67ba026..b3dcf25 100644 --- a/gpu-opt/main.cu +++ b/gpu-opt/main.cu @@ -131,13 +131,14 @@ bool add_coset( int *coset, int *hint, thrust::device_vector &dcosets) { - thrust::host_vector cosets = dcosets; - *coset = cosets.size() / ngens; + int offset = *hint; + thrust::host_vector cosets(dcosets.begin() + offset, dcosets.end()); + *coset = dcosets.size() / ngens; // todo: this part especially. - while (cosets[*hint] >= 0) { + while (cosets[*hint - offset] >= 0) { *hint = *hint + 1; - if (*hint >= cosets.size()) + if (*hint - offset >= cosets.size()) return true; } int from = *hint / ngens;