Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hipBLAS #92

Open
oschuett opened this issue Jun 13, 2021 · 11 comments
Open

Add support for hipBLAS #92

oschuett opened this issue Jun 13, 2021 · 11 comments
Labels

Comments

@oschuett
Copy link

It would be nice to have support for hipBLAS as this allows to test the hip code path on a Nvidia device.

In return the support for rocBLAS could be dropped.

@kabicm
Copy link
Collaborator

kabicm commented Jun 14, 2021

Since @gsitaraman mentioned here the potential performance benefit of using rocBLAS, I would still hesitate to switch to hipBLAS, unless you believe it's absolutely necessary.

@oschuett
Copy link
Author

I agree that you should keep rocBLAS as long as there are performance benefits to it. However, maybe you could still add support for hipBLAS alongside? It would allow me to make progress with the HIP integration testing in CP2K.

@kabicm
Copy link
Collaborator

kabicm commented Jun 15, 2021

This should be possible. @AdhocMan, do you think this would be a simple change, or would it require adding a lot of boilerplate code to the gpu-backend?

@AdhocMan
Copy link
Contributor

hipBLAS is just an additional layer on top of rocBLAS and you can compile rocBLAS with cuda. So it should work already, although I haven't tested it.

@kabicm
Copy link
Collaborator

kabicm commented Jun 15, 2021

Would we still have to add hipBLAS as a dependency of COSMA in that case?

@AdhocMan
Copy link
Contributor

No, if rocBLAS works correctly with cuda. There would just be few changes to the CMake config required.

@kabicm
Copy link
Collaborator

kabicm commented Jun 15, 2021

As written here it seems the cmake for the CUDA backend of rocBLAS is broken at the moment:

rocBLAS is written with HiP kernels, so it should build and run on CUDA platforms. However, currently the cmake infrastructure is broken with a CUDA backend. However, a BLAS marshalling library that presents a common interface for both ROCm and CUDA backends can be found with hipBLAS.

@oschuett
Copy link
Author

oschuett commented Jun 16, 2021

I also spent an hour yesterday trying to build rocBLAS for Cuda - without success so far. And even if we get it to work eventually, it will probably be rather brittle because it pulls in many additional dependencies. In comparison hipBLAS is very lightweight.

@kabicm kabicm added enhancement New feature or request feature and removed enhancement New feature or request labels Jun 16, 2021
@AdhocMan
Copy link
Contributor

That's unfortunate, it would have made things easier. I think, adding hipBLAS alongside rocBLAS does not make much sense, since adding a code path, that's only used for testing somewhat defeats it's purpose. So I'd suggest two options:

  1. Replace rocBLAS with hipBLAS. Looking at the hipBLAS code, I suspect it would not really impact performance.
  2. Keep rocBLAS and work on adding CI on AMD hardware for COSMA. In light of LUMI, there should be more support for this in the future. For building CP2K with HIP on Nvidia hardware, you could compile COSMA with CUDA (which you then require anyway), since it is standalone.

@gsitaram
Copy link

In both hipBLAS and rocBLAS, there is a heavy overhead in the first DGEMM call. If rocBLAS is used, one could call rocblas_initialize() before any DGEMM call to avoid this overhead in the timing region. We can try to do this in COSMA and shift to a hipBLAS implementation for improving portability. I will work with Marko later this week to get this done.

@AdhocMan
Copy link
Contributor

I already have a version of Tiled-MM with hipblas instead of rocblas: https://github.com/AdhocMan/Tiled-MM/tree/hipblas
It compiles fine, I just can't run it at the moment because of an issue with our test system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants