Giter Club home page Giter Club logo

Comments (14)

ntrost57 avatar ntrost57 commented on June 9, 2024

Looks like an issue with your environment. Can you compile other rocm libraries successfully?

from rocalution.

cgmb avatar cgmb commented on June 9, 2024

-- Found HIP: /opt/rocm-dev2/hip (found version "5.1.20531-")

I don't think it's the cause of the build failures you're describing here, but that version number looks like it may suffer from the problem described in ROCm/HIP#2218. You may want to apply the second patch in this gist before building hipamd.

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

@ntrost57 Thanks for helping me with this one. What makes you think so? I have managed to build several other ROCm libraries (using hipcc) with no issue; for instance, rocRAND, rocSPARSE, rocSOLVER. On the other hand, I am having issues with rocFFT as well but again it seems a programming error to me.

May be some CMake option I am missing? It would be very helpful if you could you share with me the CMake options you use to build this library :)

@cgmb Thank you Cory for your prompt help, once again! I took note of that patch and added it to my build process.

from rocalution.

ntrost57 avatar ntrost57 commented on June 9, 2024

Can you try install.sh script for compilation?

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

I can't use the install script because of the reasons listed in this other similar issue. But I went through your install script and I believe that the issue is the option

[line 21]   echo "    [--host] build library for host backend only"

Might be that ${build_host} is set to true in your testing and then the code

 # HIP / Host only
  if [[ "${build_host}" == true ]]; then
    cmake_common_options="${cmake_common_options} -DSUPPORT_HIP=OFF"
  else
    cmake_common_options="${cmake_common_options} -DSUPPORT_HIP=ON"
  fi

disables HIP support? Then you wouldn't compile the above code that gives me error.

To confirm this, i will try to compile with -DSUPPORT_HIP=OFF. But what are the implications? The code will only run on CPU right?

from rocalution.

ntrost57 avatar ntrost57 commented on June 9, 2024

We are testing for both, host and device build. If you compile with -DSUPPORT_HIP=OFF the code will only run on CPU.
I am not able to reproduce the error you see, using rocm-5.1.1 with posted commit id running the given cmake command on Ubuntu 20.04.

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

@ntrost57 would you post your cmake configuration here? I have noticed that my version of hip is 5.1.2xx, you might be using 5.1.1? To obtain the rocm repositories i followed the instructions in your website and used the repo command. It checked out the branch 5.1.x of the rocm repository, where instructions to download all repositories are stored. So i might be using a newer version of hip than you. I am not on my laptop now, but I'll post the exact version (commit hash) of hip I am using, maybe the bug is there

from rocalution.

ntrost57 avatar ntrost57 commented on June 9, 2024

I have been using HIP 5.1.20531-cacfa990 (rocm-5.1.1) what is exactly what you pasted in the logs.
You can use the rocm/dev-ubuntu-20.04:latest docker image for a clean rocm-5.1.1 installation. After installing rocsparse, rocblas, rocprim and rocrand, you should be able to successfully build rocalution.

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

@ntrost57 that is very interesting. I am currently using a VM to try the build but ultimately I need to install ROCm on a supercomputer, so I would like to avoid containers. Coming back to the error I get, looks like the problem is that the * operator is called on two object of std::complex<double>. The overloaded function to handle this operation is defined in the standard library and is host code that can't be called within a kernel unless it has been redefined to have also the __device__ attribute. So it seems you have such definition in your HIP installation, and I don't. I will dig more into it, hopefully I will find a way to solve this.

from rocalution.

stepannassyr avatar stepannassyr commented on June 9, 2024

Ran into the same issue with 5.1.3. Wrote this workaround:

diff --git a/src/base/hip/hip_vector.hpp b/src/base/hip/hip_vector.hpp
index 0444528..a432359 100644
--- a/src/base/hip/hip_vector.hpp
+++ b/src/base/hip/hip_vector.hpp
@@ -30,11 +30,77 @@
 #include "../base_vector.hpp"
 
 #include <hip/hip_runtime.h>
+#include <hip/amd_detail/amd_hip_complex.h>
 
 #include <complex>
 
 #include "hip_rand.hpp"
 
+#if defined(__HIPCC_RTC__)
+#define __HOST_DEVICE__ __device__
+#else
+#define __HOST_DEVICE__ __host__ __device__
+#endif // !defined(__HIPCC_RTC__)
+
+// Gotta put these somewhere
+__HOST_DEVICE__ inline std::complex<float> operator+(const std::complex<float> a, const std::complex<float> b)
+{
+    auto ahip = make_hipFloatComplex(a.real(), a.imag());
+    auto bhip = make_hipFloatComplex(b.real(), b.imag());
+    auto res = a+b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<float> operator-(const std::complex<float> a, const std::complex<float> b)
+{
+    auto ahip = make_hipFloatComplex(a.real(), a.imag());
+    auto bhip = make_hipFloatComplex(b.real(), b.imag());
+    auto res = a-b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<float> operator*(const std::complex<float> a, const std::complex<float> b)
+{
+    auto ahip = make_hipFloatComplex(a.real(), a.imag());
+    auto bhip = make_hipFloatComplex(b.real(), b.imag());
+    auto res = a*b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<float> operator/(const std::complex<float> a, const std::complex<float> b)
+{
+    auto ahip = make_hipFloatComplex(a.real(), a.imag());
+    auto bhip = make_hipFloatComplex(b.real(), b.imag());
+    auto res = a/b;
+    return res;
+}
+
+__HOST_DEVICE__ inline std::complex<double> operator+(const std::complex<double> a, const std::complex<double> b)
+{
+    auto ahip = make_hipDoubleComplex(a.real(), a.imag());
+    auto bhip = make_hipDoubleComplex(b.real(), b.imag());
+    auto res = a+b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<double> operator-(const std::complex<double> a, const std::complex<double> b)
+{
+    auto ahip = make_hipDoubleComplex(a.real(), a.imag());
+    auto bhip = make_hipDoubleComplex(b.real(), b.imag());
+    auto res = a-b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<double> operator*(const std::complex<double> a, const std::complex<double> b)
+{
+    auto ahip = make_hipDoubleComplex(a.real(), a.imag());
+    auto bhip = make_hipDoubleComplex(b.real(), b.imag());
+    auto res = a*b;
+    return res;
+}
+__HOST_DEVICE__ inline std::complex<double> operator/(const std::complex<double> a, const std::complex<double> b)
+{
+    auto ahip = make_hipDoubleComplex(a.real(), a.imag());
+    auto bhip = make_hipDoubleComplex(b.real(), b.imag());
+    auto res = a/b;
+    return res;
+}
+
 namespace rocalution
 {
     template <typename ValueType>

from rocalution.

stepannassyr avatar stepannassyr commented on June 9, 2024

Aaand now I'm realizing what I wrote doesn't even use the converted ahip = .... Hm but it does compile though

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

Thanks for your input @stepannassyr. Indeed it is very strange, to be honest looks like a recursive definition that never ends.. so not sure it will work at runtime. I think there is definitely an issue somewhere in rocm..

from rocalution.

dipietrantonio avatar dipietrantonio commented on June 9, 2024

This issue is not present anymore in ROCm 5.2, although I found another one in rocALUTION/src/solvers/multigrid/ruge_stueben_amg.hpp:

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
#else
        [[deprecated("This function will be removed in a future release. Use "
                     "SetStrengthThreshold() instead")]]
#endif

Had to remove the code in the else block because it wouldnt compile using hipcc (clang-14).

from rocalution.

doctorcolinsmith avatar doctorcolinsmith commented on June 9, 2024

Hello @dipietrantonio. As the original issue is resolved, I am closing this issue.

The new comment about ruge_stueben_amg.hpp is copied to a new issue (#151).

from rocalution.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.