uvok on Nostr: I am doing My solution for puzzle 9 "Pooling" is def pool_test(cuda): def call(out, ...
I am doing
https://github.com/srush/GPU-Puzzles/My solution for puzzle 9 "Pooling" is
def pool_test(cuda):
def call(out, a, size) -> None:
shared = cuda.shared.array(TPB, numba.float32)
i = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
local_i = cuda.threadIdx.x
mysum = 0
for j in range(max(0,i-2), i+1):
mysum += a[j]
out[i] = mysum
return call
But I doubt that this is the solution, as I don't utilize the shared memory...
#programming #python #numba
Published at
2024-09-29 14:37:04Event JSON
{
"id": "9f665983d51bcd5f00d3921522dcaba67a9dd003c89d3c12d7b50ce7ffa09bb1",
"pubkey": "b15e52e9623da51cfe460020e7da27a086de784731ae755e0bb94e9f1c113cb2",
"created_at": 1727620624,
"kind": 1,
"tags": [
[
"t",
"programming"
],
[
"t",
"python"
],
[
"t",
"numba"
],
[
"proxy",
"https://furry.engineer/users/uvok/statuses/113221345265949579",
"activitypub"
]
],
"content": "I am doing https://github.com/srush/GPU-Puzzles/\n\nMy solution for puzzle 9 \"Pooling\" is\n\ndef pool_test(cuda):\n def call(out, a, size) -\u003e None:\n shared = cuda.shared.array(TPB, numba.float32)\n i = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x\n local_i = cuda.threadIdx.x\n\n mysum = 0\n for j in range(max(0,i-2), i+1):\n mysum += a[j]\n out[i] = mysum\n\n return call\n\n\nBut I doubt that this is the solution, as I don't utilize the shared memory...\n\n#programming #python #numba",
"sig": "63f869afc39c026cddfece7ea5ec71bc40627378145357403b9e52b30041650ca67502231a58a1ba6a85c76a9243156d2fde7e90372092bcf4abee2d6b1a0acd"
}