From cf369c9fcf49b43c6607507ad439b6ecca89dfc3 Mon Sep 17 00:00:00 2001 From: Wei CUI Date: Fri, 4 Nov 2022 01:54:36 +0800 Subject: [PATCH] update ROCm dockerfile to 5.3 --- backends/c-rocm/include/backend.hpp | 12 +++++++----- docker/Dockerfile.c-rocm | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/backends/c-rocm/include/backend.hpp b/backends/c-rocm/include/backend.hpp index 9a94bcb..7f690da 100644 --- a/backends/c-rocm/include/backend.hpp +++ b/backends/c-rocm/include/backend.hpp @@ -98,14 +98,16 @@ namespace ab { if (!_gpu_arch.size()) { hipDeviceProp_t prop; CHECK_OK(0 == hipGetDeviceProperties(&prop, _current_device)); - _gpu_arch = std::to_string(prop.gcnArch); + _gpu_arch = "gfx" + std::to_string(prop.gcnArch); } - auto code = get_between(source, "\n#define __AMDGFX__ ", "\n"); - if (code.size() == 0) - code = "gfx" + _gpu_arch; + std::vector codes = { get_between(source, "\n#define __AMDGFX__ ", "\n") }; + if (codes[0].size() == 0) + codes[0] = _gpu_arch; - std::vector compile_args = {"/opt/rocm/bin/hipcc", path, "--genco", "-O2", ("--amdgpu-target=" + code), "-Wno-ignored-attributes", "-o", (path + ".out")}; + std::vector compile_args = {"/opt/rocm/bin/hipcc", path, "--genco", "-O2", "-Wno-ignored-attributes", "-o", (path + ".out")}; + for (auto &code: codes) + compile_args.push_back("--amdgpu-target=" + code); #endif ab_utils::Process(compile_args, 30); diff --git a/docker/Dockerfile.c-rocm b/docker/Dockerfile.c-rocm index 3a8f378..e57eeed 100644 --- a/docker/Dockerfile.c-rocm +++ b/docker/Dockerfile.c-rocm @@ -19,13 +19,14 @@ RUN apt-get update && apt install -y --no-install-recommends git ca-certificates RUN curl -L https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - -RUN printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/4.2/ xenial main" | tee /etc/apt/sources.list.d/rocm_hip.list && \ +RUN printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/5.3/ ubuntu main" | tee /etc/apt/sources.list.d/rocm_hip.list && \ apt update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ rocm-dev rocblas hipsparse rccl rocfft hipfft rocrand miopen-hip rocthrust hip-rocclr && apt-get clean && rm -rf /var/lib/apt/lists/* RUN /bin/echo -e "set backspace=indent,eol,start\nset nocompatible\nset ts=4" > /etc/vim/vimrc.tiny -RUN pip3 install --upgrade antares && mkdir -p /root/.local/antares && ln -s $(antares pwd)/../3rdparty /root/.local/antares/3rdparty +RUN pip3 install --upgrade antares && mkdir -p /root/.local/antares && mv $(antares pwd)/../3rdparty /root/.local/antares/3rdparty && pip3 uninstall antares -y +RUN echo 'exec /antares/main.py "$@"' > /usr/local/bin/antares && chmod a+x /usr/local/bin/antares # OpenCL has been included in ROCm already RUN rm -rf /usr/lib/x86_64-linux-gnu/libOpenCL.so.1*