|
| 1 | +#------------------------------------------------------------------------------------------# |
| 2 | +# This file is part of Pyccel which is released under MIT License. See the LICENSE file or # |
| 3 | +# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. # |
| 4 | +#------------------------------------------------------------------------------------------# |
| 5 | +""" |
| 6 | +This module contains all the CUDA thread indexing methods |
| 7 | +""" |
| 8 | +class CudaThreadIndexing: |
| 9 | + """ |
| 10 | + Class representing the CUDA thread indexing. |
| 11 | +
|
| 12 | + Class representing the CUDA thread indexing. |
| 13 | +
|
| 14 | + Parameters |
| 15 | + ---------- |
| 16 | + block_idx : int |
| 17 | + The index of the block in the x-dimension. |
| 18 | +
|
| 19 | + thread_idx : int |
| 20 | + The index of the thread in the x-dimension. |
| 21 | + """ |
| 22 | + def __init__(self, block_idx, thread_idx): |
| 23 | + self._block_idx = block_idx |
| 24 | + self._thread_idx = thread_idx |
| 25 | + |
| 26 | + def threadIdx(self, dim): |
| 27 | + """ |
| 28 | + Get the thread index. |
| 29 | +
|
| 30 | + Get the thread index. |
| 31 | +
|
| 32 | + Parameters |
| 33 | + ---------- |
| 34 | + dim : int |
| 35 | + The dimension of the indexing. It can be: |
| 36 | + - 0 for the x-dimension |
| 37 | + - 1 for the y-dimension |
| 38 | + - 2 for the z-dimension |
| 39 | +
|
| 40 | + Returns |
| 41 | + ------- |
| 42 | + int |
| 43 | + The index of the thread in the specified dimension of its block. |
| 44 | + """ |
| 45 | + return self._thread_idx |
| 46 | + |
| 47 | + def blockIdx(self, dim): |
| 48 | + """ |
| 49 | + Get the block index. |
| 50 | +
|
| 51 | + Get the block index. |
| 52 | +
|
| 53 | + Parameters |
| 54 | + ---------- |
| 55 | + dim : int |
| 56 | + The dimension of the indexing. It can be: |
| 57 | + - 0 for the x-dimension |
| 58 | + - 1 for the y-dimension |
| 59 | + - 2 for the z-dimension |
| 60 | +
|
| 61 | + Returns |
| 62 | + ------- |
| 63 | + int |
| 64 | + The index of the block in the specified dimension. |
| 65 | + """ |
| 66 | + return self._block_idx |
| 67 | + |
| 68 | + def blockDim(self, dim): |
| 69 | + """ |
| 70 | + Get the block dimension. |
| 71 | +
|
| 72 | + Get the block dimension. |
| 73 | +
|
| 74 | + Parameters |
| 75 | + ---------- |
| 76 | + dim : int |
| 77 | + The dimension of the indexing. It can be: |
| 78 | + - 0 for the x-dimension |
| 79 | + - 1 for the y-dimension |
| 80 | + - 2 for the z-dimension |
| 81 | +
|
| 82 | + Returns |
| 83 | + ------- |
| 84 | + int |
| 85 | + The size of the block in the specified dimension. |
| 86 | + """ |
| 87 | + return 0 |
| 88 | + |
0 commit comments