Hi Bogdan,

Apparently the original code is not an optimal setting for doing the first
steps in pyCUDA. Hence, I decided to create a, as I hope, comparable
minimal-example.
In this case, I don't have an additional "level" as in the other example
with "more_custom.cuh" - here only "custom.cuh" -, but I would regard it
as comparable nevertheless.
I have the following files and respective content:

- FILE func_helper.cuh
#include <stdio.h>

__device__ void func_helper();


- FILE func_helper.cu
#include "func_helper.cuh"

__device__ void func_helper()
{
        printf("I am %d.%d\\n", threadIdx.x, threadIdx.y);
}



- FILE simple_multiple_deps.py
import pycuda.autoinit
import pycuda.driver as drv
from pycuda.compiler import SourceModule

mod = SourceModule("""
#include <cuda.h>
#include <cutil_inline.h>
#include "func_helper.cuh"

extern "C"{ 
__global__ void func()
{
        func_helper();
}
}
""", no_extern_c=1)


def call_func():
        print "===> PyCUDA version: " + pycuda.VERSION_TEXT
        print "===> CUDA version: " +  str(pycuda.driver.get_version()[0])
+ "." + str(pycuda.driver.get_version()[1]) + "." +
str(pycuda.driver.get_version()[2])
        print "===> Nvidia driver version: " +
str(pycuda.driver.get_driver_version())

        call_cuda_func = mod.get_function('func')
        call_cuda_func(block=(4,4,1))


if __name__ == "__main__":
        call_func()

Executing the python script now, gives me the following error:

pycuda.driver.CompileError: nvcc compilation of /tmp/tmpe1ZS7Z/kernel.cu
failed
[command: nvcc --cubin -arch sm_20
-I/home/clusterusers/claczny/local/lib/python2.6/dist-packages/pycuda-2012.
1-py2.6-linux-x86_64.egg/pycuda/../include/pycuda kernel.cu]
[stderr:
kernel.cu(9) Error: use of external function _Z11func_helperv is not
supported
]

Please don't get confused by the path, I need to use a "virtual" python
installation in order to be able to install pyCUDA as a user with pypi
pyCUDA (http://pypi.python.org/pypi/pycuda/). Indeed, pyCUDA is working as
tested using some of the examples online.

Searching for it, I came across the following:
http://stackoverflow.com/questions/5994005/cuda-external-calls-not-supporte
d

So, some of the questions that bother me due to this are: Should a setting
like in the minimal example be supported or is indeed the nvcc here the
"limiting" factor?

Best,

Cedric





On 17.08.12 09:27, "Bogdan Opanchuk" <[email protected]> wrote:

>Hi Cédric
>
>On Fri, Aug 17, 2012 at 5:15 PM, Cédric LACZNY <[email protected]>
>wrote:
>> Thanks for the suggestion but it's causing other errors all of the same
>> notion, e.g. the following:
>> kernel.cu(142): error: calling a host
>>function("NVMatrix::eltWiseDivide")
>> from a __device__/__global__ function("unsigned short") is not allowed
>>
>> Actually, that class NVMatrix is defined in custom.cuh.
>
>The functions that are not exported, but still executed on GPU, must
>have '__device__' qualifier, this applies to class methods too. I am
>not sure how it managed to work with plain CUDA without these
>qualifiers.


Cedric Laczny,
PhD Student
 
UNIVERSITÉ DU LUXEMBOURG
 
LUXEMBOURG CENTRE FOR SYSTEMS BIOMEDICINE
Campus Belval | House of Biomedicine
7, avenue des Hauts-Fourneaux
L-4362 Esch-sur-Alzette
T +352 46 66 44 6398
F +352 46 66 44 6949
[email protected]     http://lcsb.uni.lu <http://lcsb.uni.lu/>
 



-----
This message is confidential and may contain privileged information. It is
intended for the named recipient only. If you receive it in error please
notify me and permanently delete the original message and any copies.
-----


>


_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to