Installation Issue: Hip: Hipcc Missing Some Include Paths (?)

by ADMIN 62 views

Introduction

HIP (Heterogeneous-compute Interface for Portability) is an open-source, high-performance, and parallel programming model for heterogeneous computing. It is designed to provide a unified interface for programming various types of accelerators, including GPUs and FPGAs. However, users have reported an issue where the hipcc compiler is missing some include paths, leading to compilation errors.

Steps to Reproduce the Issue

To reproduce the issue, follow these steps:

  1. Clone the Spack repository using the following command:

git clone --branch develop --depth 1 https://github.com/spack/spack.git

2.  Install the necessary dependencies using the following command:
    ```bash
dnf install -y git gcc-c++ xz unzip bzip2 patch make
  1. Bootstrap Spack using the following command:

. /spack/share/spack/setup-env.sh && spack bootstrap now

4.  Install HIP using the following command:
    ```bash
. /spack/share/spack/setup-env.sh && spack install hip
  1. Create a test file fail1.cpp with the following content:

#include <rocm_version.h>

int main(void) { return 0; }

6.  Compile the test file using the following command:
    ```bash
hipcc fail1.cpp
  1. Observe the compilation error.

Dockerfile to Reproduce the Issue

To reproduce the issue using a Dockerfile, follow these steps:

  1. Create a new file Dockerfile with the following content:

FROM registry.access.redhat.com/ubi8:latest

RUN dnf install -y git

RUN git clone --branch develop --depth 1 https://github.com/spack/spack.git

RUN dnf install -y gcc-c++ xz unzip bzip2 patch make

RUN . /spack/share/spack/setup-env.sh
&& spack bootstrap now

RUN . /spack/share/spack/setup-env.sh
&& for j in {1..4}; do
spack install hip &
done; wait $(jobs -p)

RUN echo -e '#include <rocm_version.h>\nint main(void) {return 0;}' > /fail1.cpp RUN echo -e '#include <rocm-core/rocm_version.h>\nint main(void) {return 0;}' > /fail2.cpp

RUN echo '#!/bin/bash' > /entrypoint.sh
&& echo 'source /spack/share/spack/setup-env.sh' >> /entrypoint.sh
&& echo 'spack load hip python' >> /entrypoint.sh
&& echo 'if [ "#" -eq 0 ]; then' >> /entrypoint.sh \ && echo ' exec /bin/bash' >> /entrypoint.sh \ && echo 'else' >> /entrypoint.sh \ && echo ' exec "@"' >> /entrypoint.sh
&& echo 'fi' >> /entrypoint.sh
&& chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]

2.  Build the Docker image using the following command:
    ```bash
docker build -t hip-issue .
  1. Run the Docker container using the following command:

docker run -it hip-issue

4.  Compile the test file using the following command:
    ```bash
hipcc fail1.cpp
  1. Observe the compilation error.

Error Message

The error message is as follows:

hipcc: error: unable to find include file 'rocm_version.h'

Information on Your System

  • Spack: 1.0.0.dev0 (8823c57b726749d8921175a923d84157a29e1891)
  • Python: 3.11.11
  • Platform: linux-rhel8-sapphirerapids

Additional Information

Spack itself does not produce any errors. However, the resulting HIP environment is not configured correctly. See above.

Mentioned as Requested from spack maintainers hip

  • @afzpatel
  • @haampie
  • @renjithravindrankannath
  • @srekolam

General Information

  • [x] I have run spack debug report and reported the version of Spack/Python/Platform.
  • [x] I have run spack maintainers <name-of-the-package> and @mentioned any maintainers.
  • [x] I have uploaded the build log and environment files.
  • [x] I have searched the issues of this repo and believe this is not a duplicate.
    Q&A: Installation Issue: HIP: hipcc Missing Some Include Paths (?) ====================================================================

Q: What is the issue with the HIP installation?

A: The issue is that the hipcc compiler is missing some include paths, leading to compilation errors.

Q: What are the steps to reproduce the issue?

A: To reproduce the issue, follow these steps:

  1. Clone the Spack repository using the following command:

git clone --branch develop --depth 1 https://github.com/spack/spack.git

2.  Install the necessary dependencies using the following command:
    ```bash
dnf install -y git gcc-c++ xz unzip bzip2 patch make
  1. Bootstrap Spack using the following command:

. /spack/share/spack/setup-env.sh && spack bootstrap now

4.  Install HIP using the following command:
    ```bash
. /spack/share/spack/setup-env.sh && spack install hip
  1. Create a test file fail1.cpp with the following content:

#include <rocm_version.h>

int main(void) { return 0; }

6.  Compile the test file using the following command:
    ```bash
hipcc fail1.cpp
  1. Observe the compilation error.

Q: Can I reproduce the issue using a Dockerfile?

A: Yes, you can reproduce the issue using a Dockerfile. To do so, follow these steps:

  1. Create a new file Dockerfile with the following content:

FROM registry.access.redhat.com/ubi8:latest

RUN dnf install -y git

RUN git clone --branch develop --depth 1 https://github.com/spack/spack.git

RUN dnf install -y gcc-c++ xz unzip bzip2 patch make

RUN . /spack/share/spack/setup-env.sh
&& spack bootstrap now

RUN . /spack/share/spack/setup-env.sh
&& for j in {1..4}; do
spack install hip &
done; wait $(jobs -p)

RUN echo -e '#include <rocm_version.h>\nint main(void) {return 0;}' > /fail1.cpp RUN echo -e '#include <rocm-core/rocm_version.h>\nint main(void) {return 0;}' > /fail2.cpp

RUN echo '#!/bin/bash' > /entrypoint.sh
&& echo 'source /spack/share/spack/setup-env.sh' >> /entrypoint.sh
&& echo 'spack load hip python' >> /entrypoint.sh
&& echo 'if [ "#" -eq 0 ]; then' >> /entrypoint.sh \ && echo ' exec /bin/bash' >> /entrypoint.sh \ && echo 'else' >> /entrypoint.sh \ && echo ' exec "@"' >> /entrypoint.sh
&& echo 'fi' >> /entrypoint.sh
&& chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]

2.  Build the Docker image using the following command:
    ```bash
docker build -t hip-issue .
  1. Run the Docker container using the following command:

docker run -it hip-issue

4.  Compile the test file using the following command:
    ```bash
hipcc fail1.cpp
  1. Observe the compilation error.

Q: What is the error message?

A: The error message is as follows:

hipcc: error: unable to find include file 'rocm_version.h'

Q: What is the information on my system?

A: The information on your system is as follows:

  • Spack: 1.0.0.dev0 (8823c57b726749d8921175a923d84157a29e1891)
  • Python: 3.11.11
  • Platform: linux-rhel8-sapphirerapids

Q: What is the additional information?

A: Spack itself does not produce any errors. However, the resulting HIP environment is not configured correctly. See above.

Q: Who should I mention as requested from spack maintainers hip?

A: You should mention the following maintainers:

  • @afzpatel
  • @haampie
  • @renjithravindrankannath
  • @srekolam

Q: What is the general information?

A: You have run the following:

  • spack debug report and reported the version of Spack/Python/Platform.
  • spack maintainers <name-of-the-package> and @mentioned any maintainers.
  • Uploaded the build log and environment files.
  • Searched the issues of this repo and believe this is not a duplicate.