asc_syncthreads
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Waits until all threads in the current thread block have reached this function.
Prototype
1 | inline void asc_syncthreads() |
Parameters
None
Returns
None
Restrictions
For SIMT programming, this API is not supported.
Header File to Be Included
To use this API, the simt_api/device_sync_functions.h header file must be included.
1 | #include "simt_api/device_sync_functions.h" |
Examples
For SIMD and SIMT programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | __simt_vf__ __launch_bounds__(1024) inline void KernelSyncThreads(__gm__ float* dst, int count) { int idx = threadIdx.x; if (idx > 0 && idx < count) { dst[idx] = 1; } // Wait until all threads in the block have reached the current code. asc_syncthreads(); if (idx == 0) { dst[0] = 0; for(int i = 1023; i > 0; i--) { dst[0] += dst[i]; } } } |
1 2 | Output: [1023, 1, 1, 1 ...] |
Parent topic: Synchronization Functions