How to use besselmx function in cuda?

Hi all,

Can anyone please tell me whether besselmx function which is used in MATLAB can be used in CUDA or not? If yes, then can anyone please tell me how to use it? Thanks :)

I don’t know about matlab , but in cuda you have

http://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH__SINGLE.html#group__CUDA__MATH__SINGLE_1gee787afb8a173c23b99d89239e245c59

You just call :

cyl_bessel_i0f ( float  x )

I am not aware of a besselmx function in MATLAB. Can you point me to a description of that, please? What Bessel functions do you need, specifically (kind, order)?

The equivalent to MATLAB’s besselj() is CUDA’s jn() [POSIX naming convention] and the equivalent to MATLAB’s bessely() is CUDA’s yn() [again, POSIX naming convention].

MATLAB has besseli() for the modified Bessel function of the first kind. CUDA offers modified Bessel functions of the first kind for orders 0 and 1 only: cyl_bessel)i0(), cyl_bessel_i1().

Hi friends, Thanks for the reply. Actually I used besselmx function name just as an example. Basically, my query is about whether can we call any MATLAB in build function directly using CUDA kernel. Is there any provision like that in CUDA? If yes, then how to call it? Pls reply…

If your question is “Can a CUDA kernel call into the MATLAB library on the host” the answer is “no”, device code cannot call host code. CUDA and its accompanying libraries provide a portion of the functionality of MATLAB. If you need specific functionality from MATLAB that is not available in CUDA, you could always file an enhancement request with NVIDIA, using the bug reporting form linked from the CUDA registered developer website. When you do, please prefix the synopsis with “RFE:” to mark it as an enhancement request rather than a functional bug.

That said, I have no idea what “besselmx” is in MATLAB context. I checked the most recent MATLAB documentation at [url]http://www.mathworks.com/help/matlab/index.html[/url] and there is no “besselmx” to be found. What you are using may be additional functionality provided by a third party, maybe as code in a .m file. In that case you may want to examine that code and see whether you can port it to CUDA yourself.

I think I managed to track down what besselmx is. It is a MEX interface to a special function library, not part of MATLAB proper. See brief description below. Which of the multitude of functions provided by this interface do you actually need for your use case?

The functions in besselmx seem to be provided with complex arguments and real order. This is extremely specialized functionality. Given that CUDA currently does not provide any transcendental functions with complex argument, I would think chances of an enhancement request of that nature being handled are slim. Of course it does not hurt trying.

http://ftp.task.gda.pl/site/mathworks-toolbox/matlab/specfun/besselmx.f

C     Fortran MEX gateway function for the Amos Bessel function library.
C
C     Computes:
C         Airy functions: Ai(z), Ai'(z), Bi(z), Bi'(z)
C         Bessel functions: J_nu(z), Y_nu(z), I_nu(z), K_nu(z)
C         Hankel functions: H1_nu(z), H2_nu(z)
C         for real index nu and complex argument z.
C     MATLAB usage:
C         [w,<ierr>] = besselmx('FUN',nu,z,<scale>)
C     where
C         FUN = ASCII value of first letter in the name of the function
C             = 'A' 'B' 'J' 'Y' 'I' 'K' 'H' 
C             =  65  66  74  89  73  75  72
C         nu is a real scalar or vector,
C         z is a real or complex scalar, vector or matrix,
C         scale is an optional input parameter to provide exponential scaling.