mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-16 16:55:57 +01:00
Protect against zero length loops giving a kernel call failure
This commit is contained in:
parent
f27b9347ff
commit
b5329d8852
@ -108,6 +108,7 @@ void LambdaApply(uint64_t base, uint64_t Num, lambda Lambda)
|
|||||||
|
|
||||||
#define accelerator_loopN( iterator, num, ... ) \
|
#define accelerator_loopN( iterator, num, ... ) \
|
||||||
typedef decltype(num) Iterator; \
|
typedef decltype(num) Iterator; \
|
||||||
|
if ( num > 0 ) { \
|
||||||
auto lambda = [=] accelerator (Iterator iterator) mutable { \
|
auto lambda = [=] accelerator (Iterator iterator) mutable { \
|
||||||
__VA_ARGS__; \
|
__VA_ARGS__; \
|
||||||
}; \
|
}; \
|
||||||
@ -119,6 +120,7 @@ void LambdaApply(uint64_t base, uint64_t Num, lambda Lambda)
|
|||||||
if ( cudaSuccess != err ) { \
|
if ( cudaSuccess != err ) { \
|
||||||
printf("Cuda error %s\n",cudaGetErrorString( err )); \
|
printf("Cuda error %s\n",cudaGetErrorString( err )); \
|
||||||
exit(0); \
|
exit(0); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cpu_loop( iterator, range, ... ) thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
#define cpu_loop( iterator, range, ... ) thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user