diku-dk / bfast

GPU Implementation for BFAST
GNU General Public License v3.0
37 stars 17 forks source link

Cupy implementation #33

Open 12rambau opened 3 years ago

12rambau commented 3 years ago

I managed to get the openCL backend to work but I was missing a simple GPU implementation to compare the performances of your implementation with a simple GPU backend.

I also tested the GPU openCL implementation over large datasets in central Africa and in some countries the Python Backend was giving better results, even though it was slower.

Based on the numpy implementation I created this backend using the cupy lib (numpy for GPU). As you may understand all the modification I made to the numpy backend are the same as in thisone (as Cupy is less tolerant than Numpy). It is curently only 3% slower than the OpenCL implementation available in the develop branch and it's way easier to maintain.

It could be useful for you as an alternative backend and eventually as a reference GPU implementation for further publications.

I'm working on it in the master branch of my fork but I think I can actually merge the Numpy and Cupy implementation using a simple lazy import.

Let me know if you think it's interesting. As long as we are experiencing bugs with openCL implementation, this backend will become the reference backend in the bfast-gpu application of SEPAL.

mortvest commented 3 years ago

Great that you got it working. What was the issue?

Could you report the differences between the results of the backends as an issue (maybe with a small-ish dataset)? That should definitely be looked into.

There is problem with tuning thresholds with the OpenCL backend, which makes it perform much slower than it should. I am currently looking into that. Our experiments show that up to 5x speedup can be possible.

We are currently not interested in the cupy backend.

12rambau commented 3 years ago

The dataset is a SEPAL time series over Gabon so it cannot be used as it is. I'll try to cut it into smaller pieces to find a small dataset