Npp

Hey Marco,

Thank you for you work on the 5.0 final. I’m waiting for the 64bit build, but it’s not really urgent.:smiley:

On topic: could you wrap the npps procedures of the NVidia Performance Primitives as well, currently only nppi is wrapped.

Thanks,
Keeth

Hello

Hopefully I’ll be able to build to 64bit libs in the next few days.

Concerning NPP: It’s difficult, although not so much for the technical part. The current version of JNpp supports only the image-related functions. As for all JCu*-libraries, the functions of NPPi are offered as a 1:1 mapping of the native functions. The main reason for that is that I know that designing an API is a really, really challenging task - and I simply do not have to think about an API when just offering the functions as-they-are.

However, I also know that Java Programmers would prefer a more object-oriented API (and originally, I also wanted to write an OO-wrapper for JCuda). However, again, designing such an OO-API is hard, especially when you’re not an expert in the respective field - and I can not be an expert in BLAS, FFT, Random Number Generation, Image Processing and Signal Processing, of course :wink:

NPP is a special case. The 1:1 mapping of the C-API really is not well suited for Java, for several reasons. Apart from the ridiculous number of methods for different data types and signed/unsigned cases (which may not be required for Java in this form), nobody will/should call functions like „nppiYCbCr420ToYCbCr411_8u_P3P2R“ directly from Java - or at least, one should try to „hide“ them behind a thin layer as quickly as possible.

That’s why I started the ‚Utilities‘ library. But although I’m at least to some extent familiar with image handling and computer graphics, I doubt that I can write an appropriate wrapper library. (Once I asked in another forum for support by an ImageJ expert ( Link, in German), but did not find a supporter - I think that ImageJ might be a nice use-case example for NPPi).

All that said: I think it should not be so much effort to also provide the basic, elementary 1:1 mapping of the Signal Processing methods of NPP. Although maintaining all the libraries is already rather time consuming, this should not be so much a problem for NPP: I wrote some sorts of „utility classes“ that do large parts of the conversion automatically, given an appropriate configuration. I can try to allocate some time for that, and see whether I can provide a new ‚beta‘ version of JNpp with the NPPi-part updated for CUDA 5, and maybe a first support of the NPPs functions.

bye
Marco

Thanks, for your fast reply!
Yes, creating a OO layer would be a nice undertaking, but I (and hopefully other JCuda users) understand that that is not a one-man’s task. That’s why I would already be happy with a 1:1 mapping of the currently unmapped functions. Is that feasible? :stumm:

In any case, this would be the first step :wink: I don’t have sooo much time in the next 1-2 weeks, but will try to schedule it somewhere.

[QUOTE=keethar]Thanks, for your fast reply!
Yes, creating a OO layer would be a nice undertaking, but I (and hopefully other JCuda users) understand that that is not a one-man’s task. That’s why I would already be happy with a 1:1 mapping of the currently unmapped functions. Is that feasible? :stumm:[/QUOTE]

Any updates on this?

[off topic]: Happy new year, Marco! I wish you lots of spare time to work on your many projects, and a new GPU, too. :stuck_out_tongue_winking_eye:

Oh dear, this already has been nearly two months :eek: Recently have been busy with some other projects, although, back then, I intended to tackle it as one of the next tasks :o Maybe I should shift priorities a little. Adding at least a first version of the signal support to JNpp should not take sooo much time. I can probably do some first work now during the weekend. In any case, I’ll post updates in this thread (and in the “About JCuda” announcments).
Best wishes to you as well!

OK, I had a closer look at the NPPs part, and it seems to be straightforward - so basically the same configuration that was used for NPPi can also be used for NPPs. I’ll try to schedule a vacation this week and finish the NPPs part (and, by the way, update the NPPi part for the 5.0 version). I still have to think about some details, e.g. I think it’s better to have separate native libraries for NPPi and NPPs, but probably can upload a first version this or next week (hopefully getting the chance to build the 64bit version soon as well)

Cool!

Hello,

I’m currently uploading the new BETA version of JNpp. It will be available at jcuda.org - JNpp soon (it’s quite a feq MB to upload, but it should be available by this evening…)

Note that I could not write unit tests for the >3000 functions of NPP :wink: and I’m sure that some of them will not work properly yet. But a basic example showing the application of the new signal processing functions is available at http://www.jcuda.org/samples/JNppsBasicTest.java

bye
Marco

Excellent ::rock! I’ll get back to you with some feedback.

I just tested the npps sample and it seems to run. The nppi histogram equalization sample doesn’t seem to work anymore, though :-s
I get:

Exception in thread "main" jcuda.CudaException: Assertion failed
	at jcuda.jnpp.JNppUtils.NPP_ASSERT(JNppUtils.java:49)
	at jcuda.jnpp.utilnpp.ImageAllocatorsNPP$Allocator_8u_1.DeviceToHostCopy2D(ImageAllocatorsNPP.java:312)
	at jcuda.jnpp.utilnpp.ImagesNPP$ImageNPP.copyTo(ImagesNPP.java:124)
	at JNppHistEqualizationSample1.main(JNppHistEqualizationSample1.java:124)

Can you confirm this?

Cheers
Keeth

You’re right: Some methods that are used in the histogram equalization sample have changed in version 5.0 of NPP. They are now expecting device pointers, whereas in the previous version, they expected host pointers. I had updated the sample accordingly and tested it, but obviously did not yet upload the new version :o Now the updated version is at http://jcuda.org/samples/JNppHistEqualizationSample.java , this one should work.
(But again: JNpp should be considered as an early beta, and there may be methods which are not working properly yet, especially some of the more complex image processing methods)

Awesome Marco. I’ll provide more feedback if I encounter another bug.

Hi Marco, I have got one for you.
I traced a bug causing an cudaErrorInvalidPitchValue-error when using a ImageCPU to initialize a ImageNPP. E.g.:
protected ImageNPP(ImageCPU<T> rImage)
The problem is on line 61 of AbstractImage

    @Override
    public int width()
    {
        return oSize_.nHeight();
    }```

It only generates problems when using non-square images.
I hope you don't mind me reporting it here?

Cheers,
Keeth

It’s fine to report this here, since there is no “official” bugtracker (Once I grabbed http://code.google.com/p/jcuda/ , but it’s not really used yet - maybe I should propagate to use it, since I have to assume that especially for NPP there will be some more open issues, but until then, reporting the bugs via this forum or mail is fine).

The bug is obviously a stupid copy&paste error :o I’ll fix it for the next release (unldess you urgently need this method, it’s also possible to build an updated “snapshot” JAR for the utilities).

Thanks for this info!

Just a short note: I have uploaded new packages with the updated utilities class (the utilities package was not contained in the latest version of the packages anyhow).