1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-04 11:15:55 +01:00

Adding a non-blocking kernel launch

This commit is contained in:
Peter Boyle 2019-05-18 17:39:54 +01:00
parent 60330e05a3
commit a584b16c4a

View File

@ -128,6 +128,17 @@ void LambdaApply(uint64_t base, uint64_t Num, lambda Lambda)
} \
}
#define accelerator_loopNB( iterator, num, ... ) \
typedef decltype(num) Iterator; \
if ( num > 0 ) { \
auto lambda = [=] accelerator (Iterator iterator) mutable { \
__VA_ARGS__; \
}; \
Iterator base = 0; \
Iterator num_block = (num+gpu_threads-1)/gpu_threads; \
LambdaApply<<<num_block,gpu_threads>>>(base,num,lambda); \
}
#define cpu_loop( iterator, range, ... ) thread_loop( (auto iterator = range.begin();iterator<range.end();iterator++), { __VA_ARGS__ });
template<typename lambda> __global__