pyCUDA: обработка длинных массивов

 
0
 
Python
ava
daemvil | 30.01.2011, 21:37
Разбираюсь с программированием в CUDA. Главная задача: построить взаимнокорреляционные функции 4х массивов чисел типа float из 21млн точек каждый.
Кое что уже наваял, только экран мигает, а потом ошибку пишет после того как добавил"const int i1 = threadIdx.y + blockIdx.y * blockDim.y;", добавил в ядро условие if и объявил сетку не 65535, а [65535,65535] , не могу понять что я не так делаю? :(


import pycuda.driver as drv
import pycuda.tools
import pycuda.autoinit
import numpy
import numpy.linalg as la
from pycuda.compiler import SourceModule

mod = SourceModule("""
__global__ void multiply_them(float *dest, float *a, float *b)
{
const int i = threadIdx.x + blockIdx.x * blockDim.x;
const int i1 = threadIdx.y + blockIdx.y * blockDim.y;
if (i+i1 < 33553921)
dest[i1] = fmaf(a[i],a[i+i1],dest[i1]); //a[]*a[]+dest[]
__syncthreads();
}
""")

multiply_them = mod.get_function("multiply_them")

a = numpy.random.randn(33553921).astype(numpy.float32)
b = numpy.random.randn(33553921).astype(numpy.float32)

dest = numpy.zeros_like(a)
print "run..."
multiply_them(
drv.Out(dest), drv.In(a), drv.In(b),
grid=(65535,65535),
block=(512,1,1))



вот лог:


C:\Python27>kor.py
C:\Python27\lib\site-packages\pycuda\compiler.py:112: UserWarning: The CUDA compiler suceeded, but said the following:
kernel.cu
kernel.cu
tmpxft_00000fe0_00000000-3_kernel.cudafe1.gpu
tmpxft_00000fe0_00000000-10_kernel.cudafe2.gpu

+stdout+stderr)
run...
Traceback (most recent call last):
File "C:\Python27\kor.py", line 35, in <module>
block=(512,1,1))
File "C:\Python27\lib\site-packages\pycuda\driver.py", line 189, in function_call
Context.synchronize()
pycuda._driver.LaunchError: cuCtxSynchronize failed: launch timeout
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
LaunchError: cuCtxPopCurrent failed: launch timeout
Error in sys.exitfunc:
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: invalid context
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: invalid context
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: invalid context
Traceback (most recent call last):
File "C:\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
pycuda._driver.LaunchError: cuCtxPopCurrent failed: launch timeout
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuModuleUnload failed: invalid context
-------------------------------------------------------------------
PyCUDA ERROR: The context stack was not empty upon module cleanup.
-------------------------------------------------------------------
A context was still active when the context stack was being
cleaned up. At this point in our execution, CUDA may already
have been deinitialized, so there is no way we can finish
cleanly. The program will be aborted now.
Use Context.pop() to avoid this problem.
-------------------------------------------------------------------

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Kommentare (0)

Kommentare werden nicht hinzugefügt

Registrieren Sie sich oder melden Sie sich an, um schreiben zu können.
Unternehmen des Tages
Вы также можете добавить свою фирму в каталог IT-фирм, и публиковать статьи, новости, вакансии и другую информацию от имени фирмы.
Подробнее
Mitwirkende
  daemvil
advanced
Absenden