From ca1170e6a6ea681e29bf4e1b83a94e25c32cbc70 Mon Sep 17 00:00:00 2001 From: jayhawk-commits Date: Mon, 20 Oct 2025 14:42:41 -0400 Subject: [PATCH] Point to TheRock 7.9 branch and remove manifest --- README.md | 8 +- default.xml | 67 - tools/rocm-build/README.md | 37 - tools/rocm-build/ROCm.mk | 310 ---- tools/rocm-build/build_amd_smi_lib.sh | 146 -- tools/rocm-build/build_amdmigraphx.sh | 58 - tools/rocm-build/build_aqlprofile.sh | 152 -- tools/rocm-build/build_clang-ocl.sh | 136 -- tools/rocm-build/build_comgr.sh | 160 -- tools/rocm-build/build_composable_kernel.sh | 96 -- tools/rocm-build/build_dbgapi.sh | 170 -- tools/rocm-build/build_devicelibs.sh | 152 -- tools/rocm-build/build_half.sh | 55 - tools/rocm-build/build_hip_on_rocclr.sh | 339 ---- tools/rocm-build/build_hipblas-common.sh | 43 - tools/rocm-build/build_hipblas.sh | 79 - tools/rocm-build/build_hipblaslt.sh | 82 - tools/rocm-build/build_hipcc.sh | 143 -- tools/rocm-build/build_hipcub.sh | 60 - tools/rocm-build/build_hipfft.sh | 59 - tools/rocm-build/build_hipfort.sh | 62 - tools/rocm-build/build_hipify_clang.sh | 211 --- tools/rocm-build/build_hiprand.sh | 89 -- tools/rocm-build/build_hipsolver.sh | 76 - tools/rocm-build/build_hipsparse.sh | 75 - tools/rocm-build/build_hipsparselt.sh | 120 -- tools/rocm-build/build_hiptensor.sh | 57 - tools/rocm-build/build_hsa.sh | 151 -- tools/rocm-build/build_lightning.sh | 1397 ----------------- tools/rocm-build/build_miopen-deps.sh | 73 - tools/rocm-build/build_miopen-hip.sh | 71 - tools/rocm-build/build_mivisionx.sh | 70 - tools/rocm-build/build_omniperf.sh | 149 -- tools/rocm-build/build_omnitrace.sh | 243 --- tools/rocm-build/build_opencl_cts.sh | 128 -- tools/rocm-build/build_opencl_icd_loader.sh | 144 -- tools/rocm-build/build_opencl_on_rocclr.sh | 176 --- tools/rocm-build/build_openmp_extras.sh | 852 ---------- tools/rocm-build/build_rccl.sh | 62 - tools/rocm-build/build_rdc.sh | 144 -- tools/rocm-build/build_rocal.sh | 83 - tools/rocm-build/build_rocalution.sh | 65 - tools/rocm-build/build_rocblas.sh | 91 -- tools/rocm-build/build_rocclr.sh | 140 -- tools/rocm-build/build_rocdecode.sh | 56 - tools/rocm-build/build_rocfft.sh | 63 - tools/rocm-build/build_rocjpeg.sh | 42 - tools/rocm-build/build_rocm-cmake.sh | 137 -- tools/rocm-build/build_rocm-core.sh | 144 -- tools/rocm-build/build_rocm-dev.sh | 19 - tools/rocm-build/build_rocm-gdb.sh | 597 ------- tools/rocm-build/build_rocm.sh | 264 ---- tools/rocm-build/build_rocm_bandwidth_test.sh | 159 -- tools/rocm-build/build_rocm_smi_lib.sh | 167 -- tools/rocm-build/build_rocminfo.sh | 138 -- tools/rocm-build/build_rocmvalidationsuite.sh | 59 - tools/rocm-build/build_rocprim.sh | 68 - tools/rocm-build/build_rocprofiler-compute.sh | 148 -- .../rocm-build/build_rocprofiler-register.sh | 145 -- tools/rocm-build/build_rocprofiler-sdk.sh | 205 --- tools/rocm-build/build_rocprofiler-systems.sh | 242 --- tools/rocm-build/build_rocprofiler.sh | 187 --- tools/rocm-build/build_rocr.sh | 380 ----- tools/rocm-build/build_rocr_debug_agent.sh | 167 -- tools/rocm-build/build_rocrand.sh | 80 - tools/rocm-build/build_rocrsamples.sh | 123 -- tools/rocm-build/build_rocshmem.sh | 88 -- tools/rocm-build/build_rocsolver.sh | 75 - tools/rocm-build/build_rocsparse.sh | 72 - tools/rocm-build/build_rocthrust.sh | 62 - tools/rocm-build/build_roctracer.sh | 188 --- tools/rocm-build/build_rocwmma.sh | 64 - tools/rocm-build/build_rpp.sh | 82 - tools/rocm-build/build_thunk.sh | 228 --- tools/rocm-build/build_transferbench.sh | 41 - tools/rocm-build/compute_utils.sh | 769 --------- tools/rocm-build/docker/ubuntu22/Dockerfile | 9 - tools/rocm-build/docker/ubuntu22/README.md | 27 - .../docker/ubuntu22/install-prerequisites.sh | 324 ---- .../rocm-build/docker/ubuntu22/local-pin-600 | 3 - tools/rocm-build/docker/ubuntu22/packages | 135 -- tools/rocm-build/docker/ubuntu24/Dockerfile | 11 - tools/rocm-build/docker/ubuntu24/README.md | 27 - .../docker/ubuntu24/install-prerequisites.sh | 265 ---- .../rocm-build/docker/ubuntu24/local-pin-600 | 3 - tools/rocm-build/docker/ubuntu24/packages | 135 -- tools/rocm-build/envsetup.sh | 273 ---- tools/rocm-build/post_inst_pkg.sh | 124 -- tools/rocm-build/rocm-6.2.0.xml | 74 - tools/rocm-build/rocm-6.2.1.xml | 77 - tools/rocm-build/rocm-6.2.2.xml | 74 - tools/rocm-build/rocm-6.2.4.xml | 76 - tools/rocm-build/rocm-6.3.0.xml | 77 - tools/rocm-build/rocm-6.3.1.xml | 77 - tools/rocm-build/rocm-6.3.2.xml | 77 - tools/rocm-build/rocm-6.3.3.xml | 77 - tools/rocm-build/rocm-6.4.0.xml | 79 - tools/rocm-build/rocm-6.4.1.xml | 79 - tools/rocm-build/rocm-6.4.2.xml | 79 - tools/rocm-build/rocm-6.4.3.xml | 79 - tools/rocm-build/rocm-7.0.0.xml | 70 - tools/rocm-build/rocm-7.0.1.xml | 70 - tools/rocm-build/rocm-7.0.2.xml | 68 - tools/rocm-build/runner | 39 - tools/rocm-build/upload_packages.sh | 91 -- 105 files changed, 1 insertion(+), 14938 deletions(-) delete mode 100644 default.xml delete mode 100644 tools/rocm-build/README.md delete mode 100644 tools/rocm-build/ROCm.mk delete mode 100755 tools/rocm-build/build_amd_smi_lib.sh delete mode 100755 tools/rocm-build/build_amdmigraphx.sh delete mode 100755 tools/rocm-build/build_aqlprofile.sh delete mode 100755 tools/rocm-build/build_clang-ocl.sh delete mode 100755 tools/rocm-build/build_comgr.sh delete mode 100755 tools/rocm-build/build_composable_kernel.sh delete mode 100755 tools/rocm-build/build_dbgapi.sh delete mode 100755 tools/rocm-build/build_devicelibs.sh delete mode 100755 tools/rocm-build/build_half.sh delete mode 100755 tools/rocm-build/build_hip_on_rocclr.sh delete mode 100755 tools/rocm-build/build_hipblas-common.sh delete mode 100755 tools/rocm-build/build_hipblas.sh delete mode 100755 tools/rocm-build/build_hipblaslt.sh delete mode 100755 tools/rocm-build/build_hipcc.sh delete mode 100755 tools/rocm-build/build_hipcub.sh delete mode 100755 tools/rocm-build/build_hipfft.sh delete mode 100755 tools/rocm-build/build_hipfort.sh delete mode 100755 tools/rocm-build/build_hipify_clang.sh delete mode 100755 tools/rocm-build/build_hiprand.sh delete mode 100755 tools/rocm-build/build_hipsolver.sh delete mode 100755 tools/rocm-build/build_hipsparse.sh delete mode 100755 tools/rocm-build/build_hipsparselt.sh delete mode 100755 tools/rocm-build/build_hiptensor.sh delete mode 100755 tools/rocm-build/build_hsa.sh delete mode 100755 tools/rocm-build/build_lightning.sh delete mode 100755 tools/rocm-build/build_miopen-deps.sh delete mode 100755 tools/rocm-build/build_miopen-hip.sh delete mode 100755 tools/rocm-build/build_mivisionx.sh delete mode 100755 tools/rocm-build/build_omniperf.sh delete mode 100755 tools/rocm-build/build_omnitrace.sh delete mode 100755 tools/rocm-build/build_opencl_cts.sh delete mode 100755 tools/rocm-build/build_opencl_icd_loader.sh delete mode 100755 tools/rocm-build/build_opencl_on_rocclr.sh delete mode 100755 tools/rocm-build/build_openmp_extras.sh delete mode 100755 tools/rocm-build/build_rccl.sh delete mode 100755 tools/rocm-build/build_rdc.sh delete mode 100755 tools/rocm-build/build_rocal.sh delete mode 100755 tools/rocm-build/build_rocalution.sh delete mode 100755 tools/rocm-build/build_rocblas.sh delete mode 100755 tools/rocm-build/build_rocclr.sh delete mode 100755 tools/rocm-build/build_rocdecode.sh delete mode 100755 tools/rocm-build/build_rocfft.sh delete mode 100755 tools/rocm-build/build_rocjpeg.sh delete mode 100755 tools/rocm-build/build_rocm-cmake.sh delete mode 100755 tools/rocm-build/build_rocm-core.sh delete mode 100755 tools/rocm-build/build_rocm-dev.sh delete mode 100755 tools/rocm-build/build_rocm-gdb.sh delete mode 100755 tools/rocm-build/build_rocm.sh delete mode 100755 tools/rocm-build/build_rocm_bandwidth_test.sh delete mode 100755 tools/rocm-build/build_rocm_smi_lib.sh delete mode 100755 tools/rocm-build/build_rocminfo.sh delete mode 100755 tools/rocm-build/build_rocmvalidationsuite.sh delete mode 100755 tools/rocm-build/build_rocprim.sh delete mode 100755 tools/rocm-build/build_rocprofiler-compute.sh delete mode 100755 tools/rocm-build/build_rocprofiler-register.sh delete mode 100755 tools/rocm-build/build_rocprofiler-sdk.sh delete mode 100755 tools/rocm-build/build_rocprofiler-systems.sh delete mode 100755 tools/rocm-build/build_rocprofiler.sh delete mode 100755 tools/rocm-build/build_rocr.sh delete mode 100755 tools/rocm-build/build_rocr_debug_agent.sh delete mode 100755 tools/rocm-build/build_rocrand.sh delete mode 100755 tools/rocm-build/build_rocrsamples.sh delete mode 100755 tools/rocm-build/build_rocshmem.sh delete mode 100755 tools/rocm-build/build_rocsolver.sh delete mode 100755 tools/rocm-build/build_rocsparse.sh delete mode 100755 tools/rocm-build/build_rocthrust.sh delete mode 100755 tools/rocm-build/build_roctracer.sh delete mode 100755 tools/rocm-build/build_rocwmma.sh delete mode 100755 tools/rocm-build/build_rpp.sh delete mode 100755 tools/rocm-build/build_thunk.sh delete mode 100755 tools/rocm-build/build_transferbench.sh delete mode 100755 tools/rocm-build/compute_utils.sh delete mode 100644 tools/rocm-build/docker/ubuntu22/Dockerfile delete mode 100644 tools/rocm-build/docker/ubuntu22/README.md delete mode 100644 tools/rocm-build/docker/ubuntu22/install-prerequisites.sh delete mode 100644 tools/rocm-build/docker/ubuntu22/local-pin-600 delete mode 100644 tools/rocm-build/docker/ubuntu22/packages delete mode 100644 tools/rocm-build/docker/ubuntu24/Dockerfile delete mode 100644 tools/rocm-build/docker/ubuntu24/README.md delete mode 100644 tools/rocm-build/docker/ubuntu24/install-prerequisites.sh delete mode 100644 tools/rocm-build/docker/ubuntu24/local-pin-600 delete mode 100644 tools/rocm-build/docker/ubuntu24/packages delete mode 100755 tools/rocm-build/envsetup.sh delete mode 100755 tools/rocm-build/post_inst_pkg.sh delete mode 100644 tools/rocm-build/rocm-6.2.0.xml delete mode 100644 tools/rocm-build/rocm-6.2.1.xml delete mode 100644 tools/rocm-build/rocm-6.2.2.xml delete mode 100644 tools/rocm-build/rocm-6.2.4.xml delete mode 100644 tools/rocm-build/rocm-6.3.0.xml delete mode 100644 tools/rocm-build/rocm-6.3.1.xml delete mode 100644 tools/rocm-build/rocm-6.3.2.xml delete mode 100644 tools/rocm-build/rocm-6.3.3.xml delete mode 100644 tools/rocm-build/rocm-6.4.0.xml delete mode 100644 tools/rocm-build/rocm-6.4.1.xml delete mode 100644 tools/rocm-build/rocm-6.4.2.xml delete mode 100644 tools/rocm-build/rocm-6.4.3.xml delete mode 100644 tools/rocm-build/rocm-7.0.0.xml delete mode 100644 tools/rocm-build/rocm-7.0.1.xml delete mode 100644 tools/rocm-build/rocm-7.0.2.xml delete mode 100755 tools/rocm-build/runner delete mode 100755 tools/rocm-build/upload_packages.sh diff --git a/README.md b/README.md index 0ee44e6b8..f3b2c4e70 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,10 @@ source software compilers, debuggers, and libraries. ROCm is fully integrated in ## Getting and Building ROCm from Source -Please use [TheRock](https://github.com/ROCm/TheRock) build system to build ROCm from source. +Please use [TheRock](https://github.com/ROCm/TheRock/tree/release/therock-7.9) build system to build ROCm from source. ## ROCm documentation -This repository contains the [manifest file](https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md) -for ROCm releases, changelogs, and release information. - -The `default.xml` file contains information for all repositories and the associated commit used to build -the current ROCm release; `default.xml` uses the [Manifest Format repository](https://gerrit.googlesource.com/git-repo/). - Source code for our documentation is located in the `/docs` folder of most ROCm repositories. The `develop` branch of our repositories contains content for the next ROCm release. diff --git a/default.xml b/default.xml deleted file mode 100644 index 19d40cd4f..000000000 --- a/default.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/README.md b/tools/rocm-build/README.md deleted file mode 100644 index d8d81941e..000000000 --- a/tools/rocm-build/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Overview for ROCm.mk - -This Makefile builds the various projects that makes up ROCm in the correct order. -It is expected to be run in an environment with the tooling set up. An easy way -to do this is to use Docker. - -## Targets - -* all (default) -* rocm-dev (a subset of all) -* clean -* list_components -* help -* T_foo -* C_foo - -## Makefile Variables - -* PEVAL set to 1 to enable some Makefile debugging code. -* RELEASE\_FLAG set to "" to avoid passing "-r" to builds, effect is package defined. -* NOBUILD="foo bar" to avoid adding foo and bar into the dependencies of top level targets. They still may be - built if they are needed as dependencies of other top level targets. -* toplevel - -## Makefile assumptions - -### Requirements for package "foo" - -#### program build\_foo.sh - -* Should take option "-c" to clean -* Should take option "-r" to do a normal "RelWithDeb" build - -### For package "foo" we define some targets - -* T\_foo - The main build target, calls "build\_foo.sh -r" -* C\_foo - Clean target, calls "build_foo.sh -c" diff --git a/tools/rocm-build/ROCm.mk b/tools/rocm-build/ROCm.mk deleted file mode 100644 index bc1e18ddc..000000000 --- a/tools/rocm-build/ROCm.mk +++ /dev/null @@ -1,310 +0,0 @@ -# Traditional first make target -all: - -# Use bash as a shell -# On Ubuntu sh is 'dash' -SHELL:=bash - -# Allow RELEASE_FLAG to be overwritten -RELEASE_FLAG?=-r - -# Set SANITIZER_FLAG for sanitizer -ASAN_DEP:= -ifeq (${ENABLE_ADDRESS_SANITIZER},true) - ASAN_DEP=lightning - SANITIZER_FLAG=--address_sanitizer -endif - -# Set STATIC_FLAG for static builds -ifeq (${ENABLE_STATIC_BUILDS},true) - STATIC_FLAG=-s -endif - -export INFRA_REPO:=ROCm/tools/rocm-build - -# # commannds to be run at makefile read time -# # should only output $$OUT_DIR to stdout -# # In an ideal world this would be another target -# define INITBUILD -# source ${INFRA_REPO}/envsetup.sh >/dev/null 2>&1; -# [ -w "$${ROCM_INSTALL_PATH}" ] || sudo mkdir -p -m 775 "$${ROCM_INSTALL_PATH}" ; -# sudo chown "$$(id -u):$$(id -g)" "$${ROCM_INSTALL_PATH}" "/home/$$(id -un)" ; -# mkdir -p ${HOME}/.ccache ; -# echo $${OUT_DIR} ; -# endef - -OUT_DIR:=$(shell . ${INFRA_REPO}/envsetup.sh >/dev/null 2>&1 ; echo $${OUT_DIR}) -ROCM_INSTALL_PATH:=$(shell . ${INFRA_REPO}/envsetup.sh >/dev/null 2>&1 ; echo $${ROCM_INSTALL_PATH}) - -$(info OUT_DIR=${OUT_DIR}) -$(info ROCM_INSTALL_PATH=${ROCM_INSTALL_PATH}) - -# define SILENT to be empty to see the runner invocation -SILENT?= @ - -# ------------------------------------------------------------------------- -# Internal stuff. Could be put in a different file to hide it. -# Internal macros, they need to be defined before being used. - -# The internal "eval" allows parts of the Makefile to be generated. -# Whilst it is possible to dump the effective Makefile, it can be -# hard to see where parts come from. Set up the "peval" macro which -# optionally prints out the generated makefile snippet and evaluate it. -# Use "make PEVAL=1 all" to see the things being evaluated. -ifeq (,${PEVAL}) - define peval = - $(eval $1) - endef -else - define peval = - $(eval $(info $1)$1) - endef -endif - -# macro to add dependencies. Saves having to put all the OUT_DIR/logs in -# The outer strip is to work around a gnu make 4.1 and earlier bug -# It should not be needed. -define adddep = -$(strip $(call peval,components+= $(1) $(2)) -$(call peval,$(1)_DEPS += $(2)) -$(foreach comp,$(strip $2),$(call peval,${OUT_DIR}/logs/${1}.txt: ${OUT_DIR}/logs/${comp}.txt)) -) -endef -# End of internal stuff that is needed at the start of the file -# ------------------------------------------------------------------------- - -# Dependencies. These can be updated. Anything that is mentioned in -# either the args to the adddep macro will be added to components. as -# an example there is no need for the adddep of lightning, as it -# depends on nothing and at least one other component includes it. - -# Syntax. Up to the first comma everything is fixed. The "call" is a -# keyword to gnu make. The "adddep" is the name of the variable containing -# the macro. -# The second comma delimited argument is the target. -# The third comma delimited arg is the thing that the target depends on. -# It is a space seperated list with zero or more elements. - -$(call adddep,amd_smi_lib,${ASAN_DEP}) -$(call adddep,aqlprofile,${ASAN_DEP} rocr) -$(call adddep,comgr,lightning devicelibs) -$(call adddep,dbgapi,rocr comgr) -$(call adddep,devicelibs,lightning) -$(call adddep,hip_on_rocclr,${ASAN_DEP} rocr comgr hipcc rocprofiler-register) -$(call adddep,hipcc,) -$(call adddep,hipify_clang,hip_on_rocclr lightning) -$(call adddep,lightning,) -$(call adddep,opencl_on_rocclr,${ASAN_DEP} rocr comgr) -$(call adddep,openmp_extras,lightning devicelibs rocr) -$(call adddep,rocm_bandwidth_test,${ASAN_DEP} rocr) -$(call adddep,rocm_smi_lib,${ASAN_DEP}) -$(call adddep,rocm-cmake,${ASAN_DEP}) -$(call adddep,rocm-core,${ASAN_DEP}) -$(call adddep,rocm-gdb,dbgapi) -$(call adddep,rocminfo,${ASAN_DEP} rocr) -$(call adddep,rocprofiler-register,${ASAN_DEP}) -$(call adddep,rocprofiler-sdk,${ASAN_DEP} rocr aqlprofile opencl_on_rocclr hip_on_rocclr comgr rccl rocdecode) -$(call adddep,rocprofiler-systems,${ASAN_DEP} hipcc rocr hip_on_rocclr rocm_smi_lib rocprofiler roctracer rocprofiler-sdk) -$(call adddep,rocprofiler,${ASAN_DEP} rocr roctracer aqlprofile opencl_on_rocclr hip_on_rocclr comgr) -$(call adddep,rocprofiler-compute,${ASAN_DEP}) -$(call adddep,rocr,${ASAN_DEP} lightning rocm_smi_lib devicelibs rocprofiler-register) -$(call adddep,rocr_debug_agent,${ASAN_DEP} hip_on_rocclr rocr dbgapi) -$(call adddep,rocrsamples,lightning devicelibs rocr ) -$(call adddep,roctracer,${ASAN_DEP} rocr hip_on_rocclr) - - -# rocm-dev points to all possible last finish components of Stage1 build. -rocm-dev-components :=amd_smi_lib aqlprofile comgr dbgapi devicelibs hip_on_rocclr hipcc hipify_clang \ - lightning rocprofiler-compute opencl_on_rocclr openmp_extras rocm_bandwidth_test rocm_smi_lib \ - rocm-cmake rocm-core rocm-gdb rocminfo rocprofiler-register rocprofiler-sdk rocprofiler-systems \ - rocprofiler rocr rocr_debug_agent rocrsamples roctracer -$(call adddep,rocm-dev,$(filter-out ${NOBUILD},${rocm-dev-components})) - -$(call adddep,amdmigraphx,hip_on_rocclr half rocblas miopen-hip lightning hipcc hiptensor) -$(call adddep,composable_kernel,lightning hipcc hip_on_rocclr rocm-cmake) -$(call adddep,half,rocm-cmake) -$(call adddep,hipblas-common,lightning) -$(call adddep,hipblas,hip_on_rocclr rocblas rocsolver lightning hipcc) -$(call adddep,hipblaslt,hip_on_rocclr openmp_extras lightning hipcc hipblas-common roctracer) -$(call adddep,hipcub,hip_on_rocclr rocprim lightning hipcc) -$(call adddep,hipfft,hip_on_rocclr openmp_extras rocfft rocrand hiprand lightning hipcc) -$(call adddep,hipfort,rocblas hipblas rocsparse hipsparse rocfft hipfft rocrand hiprand rocsolver hipsolver lightning hipcc) -$(call adddep,hiprand,hip_on_rocclr rocrand lightning hipcc) -$(call adddep,hipsolver,hip_on_rocclr rocblas rocsolver rocsparse lightning hipcc hipsparse) -$(call adddep,hipsparse,hip_on_rocclr rocsparse lightning hipcc) -$(call adddep,hipsparselt,hip_on_rocclr hipsparse lightning hipcc openmp_extras) -$(call adddep,hiptensor,hip_on_rocclr composable_kernel lightning hipcc) -$(call adddep,miopen-deps,lightning hipcc) -$(call adddep,miopen-hip,rocm-core composable_kernel half hip_on_rocclr miopen-deps hipblas hipblaslt rocrand roctracer lightning hipcc) -$(call adddep,mivisionx,amdmigraphx miopen-hip rpp lightning hipcc) -$(call adddep,rccl,rocm-core hip_on_rocclr rocr lightning hipcc rocm_smi_lib hipify_clang) -$(call adddep,rdc,amd_smi_lib rocprofiler-sdk rocm_smi_lib rocprofiler rocmvalidationsuite) -$(call adddep,rocalution,rocblas rocsparse rocrand lightning hipcc) -$(call adddep,rocblas,rocminfo hip_on_rocclr openmp_extras lightning hipcc hipblaslt) -$(call adddep,rocal,mivisionx) -$(call adddep,rocdecode,hip_on_rocclr lightning hipcc) -$(call adddep,rocfft,hip_on_rocclr rocrand hiprand lightning hipcc openmp_extras) -$(call adddep,rocjpeg,hip_on_rocclr lightning hipcc) -$(call adddep,rocmvalidationsuite,hip_on_rocclr rocr hipblas hiprand hipblaslt rocm-core lightning hipcc rocm_smi_lib) -$(call adddep,rocprim,hip_on_rocclr lightning hipcc) -$(call adddep,rocrand,hip_on_rocclr lightning hipcc) -$(call adddep,rocshmem,rccl ) -$(call adddep,rocsolver,hip_on_rocclr rocblas rocsparse rocprim lightning hipcc) -$(call adddep,rocsparse,hip_on_rocclr rocprim lightning hipcc) -$(call adddep,rocthrust,hip_on_rocclr rocprim lightning hipcc) -$(call adddep,rocwmma,hip_on_rocclr rocblas lightning hipcc rocm-cmake rocm_smi_lib) -$(call adddep,rpp,half lightning hipcc openmp_extras) -$(call adddep,transferbench,hip_on_rocclr lightning hipcc) -ifneq ($(filter rocm-dev upload-rocm-dev, ${MAKECMDGOALS}),) - components = $(rocm-dev-components) -endif -$(call adddep,rocm,$(filter-out ${NOBUILD} rocm,${components})) - -ifeq ($(DISTRO_NAME),rhel) - WHL_GEN := -endif - -# ------------------------------------------------------------------------- -# The rest of the file is internal -# Do not pass jobserver params if -n build -ifneq (,$(findstring n,${MAKEFLAGS})) -RMAKE:= -else -RMAKE := + -endif - - -# disable the builtin rules -.SUFFIXES: - -# Linear -# include moredeps - -# A macro to define a toplevel target, add it to the 'all' target -# Make it depend on the generated log. Generate the log of the build. - -# See if the macro is already defined, if so don't touch it. -# As GNU make allows more than one makefile to be specified with "-f" -# one could put an alternative definition of "toplevel" in a different -# file or even the environment, and use the data in this file for other -# purposes. Uses might include generating output in "dot" format for -# showing the dependency graph, or having a wrapper script to run programs -# to generate code quality tools. -ifeq (${toplevel},) -# { Start of test to see if toplevel is defined -define toplevel = - -# The "target" make, this builds the package if it is out of date -T_$1: ${OUT_DIR}/logs/$1.txt FRC - : $1 built - -# The "upload" for $1, it uploads the packages for $1 to the central storage -U_$1: T_$1 FRC - source $${INFRA_REPO}/envsetup.sh && $${INFRA_REPO}/upload_packages.sh "$1" - : $1 uploaded - -# The "clean" for $1, it just marks the target as not existing so it will be built -# in the future. -C_$1: FRC - rm -f ${OUT_DIR}/logs/$1.txt ${OUT_DIR}/logs/$1.repackaged - -# parallel build -${OUT_DIR}/logs/$1.txt: | ${OUT_DIR}/logs -ifneq ($(wildcard ${OUT_DIR}/logs/$1.repackaged),) # { - @echo Skipping build of $1 as it has already been repackaged - cat $${@:.txt=.repackaged} > $$@ - rm -f $${@:.txt=.repackaged} -else # } { - @echo $1 started due to $$? | sed "s:${OUT_DIR}/logs/::g" -# Build in a subshell so we get the time output -# Pass in jobserver info using the RMAKE variable -# Allow project specific flags e..g. ROCMBUILD_lightning. - ${RMAKE}${SILENT}( if set -x && source $${INFRA_REPO}/envsetup.sh && \ - rm -f $${@:$1.txt=1.Errors.$1.txt} $$@ $${@:.txt=.repackaged} && \ - $${INFRA_REPO}/runner $1 $${RELEASE_FLAG} $${SANITIZER_FLAG} $${STATIC_FLAG} ${ROCMBUILD_$1}; \ - then mv $${@:$1.txt=2.Inprogress.$1.txt} $$@ ; \ - else mv $${@:$1.txt=2.Inprogress.$1.txt} $${@:$1.txt=1.Errors.$1.txt} ;\ - echo Error in $1 >&2 ; exit 1 ;\ - fi ) > $${@:$1.txt=2.Inprogress.$1.txt} 2>&1 -endif # } - -# end of toplevel macro -endef -# } End of test to see if toplevel is defined -endif - -components:=$(sort $(components)) - -# Create all the T_xxxx and C_xxxx targets -$(call peval,$(foreach dep,$(strip ${components}),$(call toplevel,${dep}))) - -# Add all the T_xxxx targets to "all" except those listed in NOBUILD -# Note this does not prohibit them from being built, it just means that -# a build of "all" will not force them to be built directly -# example command -# make -f jenkins-utils/scripts/Stage1.mk -j60 - -##help all: Build everything -all: $(addprefix T_,$(filter-out ${NOBUILD},${components})) - @echo All ROCm components built -# Do not document this target -upload: $(addprefix U_,$(filter-out ${NOBUILD},${components})) - @echo All ROCm components built and uploaded - -upload-rocm-dev: $(addprefix U_,$(filter-out ${NOBUILD},${components})) - @echo All rocm-dev components built and uploaded - -##help rocm-dev: Build a subset of ROCm -rocm-dev: $(addprefix T_,$(filter-out ${NOBUILD},${components})) - @echo rocm-dev built - -ifeq ($(DISTRO_NAME),almalinux) - @sudo chmod -R 777 "/home/builder" -endif - -# This code is broken. It stops us exiting a container and -# starting a new one and continueing the build. The attempt -# is to have run-once code. -${OUT_DIR}/logs: - sudo mkdir -p -m 775 "${ROCM_INSTALL_PATH}" && \ - sudo chown -R "$(shell id -u):$(shell id -g)" "/opt" - sudo chown "$(shell id -u):$(shell id -g)" "/home/$(shell id -un)" - mkdir -p "${@}" - mkdir -p ${HOME}/.ccache - -##help clean: remove the output directory and recreate it -clean: - [ -n "${OUT_DIR}" ] && rm -rf "${OUT_DIR}" -# mkdir -p ${OUT_DIR}/logs - -.SECONDARY: ${components:%=${OUT_DIR}/logs/%} - -.PHONY: all clean repack help list_components - -# get_all_deps: Recursively get all dependencies for a given component. -# Usage: $(call get_all_deps,component_name,) -# - component_name: The name of the component to get dependencies for. -# - The second parameter is an internal parameter used to track already -# processed components to avoid circular dependencies. -define get_all_deps -$(if $(filter $(1),$(2)),,\ - $(sort $(1) $(foreach d,$($(1)_DEPS),$(call get_all_deps,$d,$(1) $(2)))) -) -endef - -##help deps_: output the dependencies for -deps_%: - @echo "=== Dependencies for [$*] ===" - @echo "$(filter-out $*,$(call get_all_deps,$*,))" - -##help list_components: output the list of components -##help : Hint make list_components | paste - - - | column -t -list_components: - @echo "${components}" | sed 'y/ /\n/' - -##help help: show this text -help: - @sed -n 's/^##help //p' ${MAKEFILE_LIST} | \ - if type -t column > /dev/null ; then column -s: -t ; else cat ; fi - -FRC: diff --git a/tools/rocm-build/build_amd_smi_lib.sh b/tools/rocm-build/build_amd_smi_lib.sh deleted file mode 100755 index e738852f4..000000000 --- a/tools/rocm-build/build_amd_smi_lib.sh +++ /dev/null @@ -1,146 +0,0 @@ - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [-c|-r|-h] [makeopts]" - echo - echo "Options:" - echo " -c, --clean Removes all amd_smi build artifacts" - echo " -r, --release Build non-debug version amd_smi (default is debug)" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -w, --wheel Creates python wheel package of amd-smi. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -p, --package Specify packaging format" - echo " -h, --help Prints this help" - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -PROJ_NAME="amdsmi" -PACKAGE_ROOT="$(getPackageRoot)" -TARGET="build" -PACKAGE_LIB=$(getLibPath) -PACKAGE_INCLUDE="$(getIncludePath)" -AMDSMI_BUILD_DIR=$(getBuildPath $PROJ_NAME) -AMDSMI_PACKAGE_DEB_DIR="$PACKAGE_ROOT/deb/$PROJ_NAME" -AMDSMI_PACKAGE_RPM_DIR="$PACKAGE_ROOT/rpm/$PROJ_NAME" -AMDSMI_BUILD_TYPE="debug" -BUILD_TYPE="Debug" - -MAKETARGET="deb" -MAKEARG="$DASH_JAY O=$AMDSMI_BUILD_DIR" -AMDSMI_MAKE_OPTS="$DASH_JAY O=$AMDSMI_BUILD_DIR -C $AMDSMI_BUILD_DIR" -AMDSMI_PKG_NAME="amd-smi-lib" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" - -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - ADDRESS_SANITIZER=true ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_amdsmi() { - rm -rf "$AMDSMI_BUILD_DIR" - rm -rf "$AMDSMI_PACKAGE_DEB_DIR" - rm -rf "$AMDSMI_PACKAGE_RPM_DIR" - rm -rf "$PACKAGE_ROOT/amd_smi" - rm -rf "$PACKAGE_INCLUDE/amd_smi" - rm -f $PACKAGE_LIB/libamd_smi.* - return 0 -} - -build_amdsmi() { - echo "Building AMDSMI" - echo "AMDSMI_BUILD_DIR: ${AMDSMI_BUILD_DIR}" - if [ ! -d "$AMDSMI_BUILD_DIR" ]; then - mkdir -p $AMDSMI_BUILD_DIR - pushd $AMDSMI_BUILD_DIR - print_lib_type $SHARED_LIBS - cmake \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_common_cmake_params) \ - $(rocm_cmake_params) \ - -DENABLE_LDCONFIG=OFF \ - -DAMD_SMI_PACKAGE="${AMDSMI_PKG_NAME}" \ - -DCPACK_PACKAGE_VERSION_MAJOR="1" \ - -DCPACK_PACKAGE_VERSION_MINOR="$ROCM_LIBPATCH_VERSION" \ - -DCPACK_PACKAGE_VERSION_PATCH="0" \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DBUILD_TESTS=ON \ - "$AMD_SMI_LIB_ROOT" - popd - fi - - echo "Making amd_smi package:" - cmake --build "$AMDSMI_BUILD_DIR" -- $AMDSMI_MAKE_OPTS - cmake --build "$AMDSMI_BUILD_DIR" -- $AMDSMI_MAKE_OPTS install - cmake --build "$AMDSMI_BUILD_DIR" -- $AMDSMI_MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$AMDSMI_PACKAGE_DEB_DIR" $AMDSMI_BUILD_DIR/*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$AMDSMI_PACKAGE_RPM_DIR" $AMDSMI_BUILD_DIR/*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${AMDSMI_PACKAGE_DEB_DIR};; - ("rpm") - echo ${AMDSMI_PACKAGE_RPM_DIR};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean_amdsmi ;; - (build) build_amdsmi; build_wheel "$AMDSMI_BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" -exit 0 diff --git a/tools/rocm-build/build_amdmigraphx.sh b/tools/rocm-build/build_amdmigraphx.sh deleted file mode 100755 index 3ce3fa2e9..000000000 --- a/tools/rocm-build/build_amdmigraphx.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src AMDMIGraphX - -build_amdmigraphx() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - - if ! command -v rbuild &> /dev/null; then - pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz - fi - - # Remove CK - xargs -d '\n' -a ${OUT_DIR}/ck.files rm -- || true - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - init_rocm_common_cmake_params - - mkdir -p ${BUILD_DIR} && rm -rf ${BUILD_DIR}/* && mkdir -p ${HOME}/amdmigraphx && rm -rf ${HOME}/amdmigraphx/* - rbuild package -d "${HOME}/amdmigraphx" -B "${BUILD_DIR}" \ - --cxx="$(set_build_variables __CLANG++__)" \ - --cc="$(set_build_variables __CLANG__)" \ - "${rocm_math_common_cmake_params[@]}" \ - -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LIB_RPATH" \ - -DCMAKE_INSTALL_RPATH="" - - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - cd $BUILD_DIR && cmake --build . -- install -j${PROC} - - show_build_cache_stats -} - -clean_amdmigraphx() { - echo "Cleaning AMDMIGraphX build directory: ${BUILD_DIR} ${DEPS_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$DEPS_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_amdmigraphx; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_amdmigraphx ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_aqlprofile.sh b/tools/rocm-build/build_aqlprofile.sh deleted file mode 100755 index d2eac5946..000000000 --- a/tools/rocm-build/build_aqlprofile.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. - No effect of the param on this build" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -API_NAME="hsa-amd-aqlprofile" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PROJ_NAME="$API_NAME" -TARGET="build" -BUILD_TYPE="Debug" -MAKETARGET="deb" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" - -VALID_STR=$(getopt -o hcro:p: --long help,clean,release,clean,outdir:,package: -- "$@") -eval set -- "$VALID_STR" - -while true; do - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="Release" - shift - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - --) - shift - break - ;; - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -copy_pkg_files_to_rocm() { - local comp_folder=$1 - local comp_pkg_name=$2 - - cd "${OUT_DIR}/${PKGTYPE}/${comp_folder}"|| exit 2 - if [ "${PKGTYPE}" = 'deb' ]; then - dpkg-deb -x ${comp_pkg_name}_*.deb pkg/ - else - mkdir pkg && pushd pkg/ || exit 2 - if [[ "${comp_pkg_name}" != *-dev* ]]; then - rpm2cpio ../${comp_pkg_name}-*.rpm | cpio -idmv - else - rpm2cpio ../${comp_pkg_name}el-*.rpm | cpio -idmv - fi - popd || exit 2 - fi - ls ./pkg -alt - sudo cp -r ./pkg/*/rocm*/* "${ROCM_PATH}" || exit 2 - rm -rf pkg/ -} - -clean() { - echo "Cleaning $PROJ_NAME package" - rm -rf "$PACKAGE_DEB" -} - -build() { - echo "Downloading $PROJ_NAME" package - if [ "$DISTRO_NAME" = ubuntu ]; then - mkdir -p "$PACKAGE_DEB" - local rocm_ver=${ROCM_VERSION} - if [ ${ROCM_VERSION##*.} = 0 ]; then - rocm_ver=${ROCM_VERSION%.*} - fi - local url="https://repo.radeon.com/rocm/apt/${rocm_ver}/pool/main/h/${API_NAME}/" - local package - package=$(curl -s "$url" | grep -Po 'href="\K[^"]*' | grep "${DISTRO_RELEASE}" | head -n 1) - - if [ -z "$package" ]; then - echo "No package found for Ubuntu version $DISTRO_RELEASE" - exit 1 - fi - - wget -t3 -P "$PACKAGE_DEB" "${url}${package}" - copy_pkg_files_to_rocm ${API_NAME} ${API_NAME} - else - echo "$DISTRO_ID is not supported..." - exit 2 - fi - - echo "Installing $PROJ_NAME" package -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo ${PACKAGE_DEB} - ;; - "rpm") - echo ${PACKAGE_RPM} - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} - -case "$TARGET" in -clean) clean ;; -build) build ;; -outdir) print_output_directory ;; -*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_clang-ocl.sh b/tools/rocm-build/build_clang-ocl.sh deleted file mode 100755 index 25f2e6dba..000000000 --- a/tools/rocm-build/build_clang-ocl.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [-c|-r|-h] [makeopts]" - echo - echo "Options:" - echo " -c, --clean Removes all clang-ocl build artifacts" - echo " -r, --release Build non-debug version clang-ocl (default is debug)" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -s, --static Supports static CI by accepting this param & not bailing out. No effect of the param though" - echo - - return 0 -} - - -TARGET="build" -CLANG_OCL_DEST="$(getBinPath)" -CLANG_OCL_SRC_ROOT="$CLANG_OCL_ROOT" -CLANG_OCL_BUILD_DIR="$(getBuildPath clang-ocl)" - -MAKEARG="$DASH_JAY" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_UTILS="$(getUtilsPath)" -CLANG_OCL_PACKAGE_DEB="$PACKAGE_ROOT/deb/clang-ocl" -CLANG_OCL_PACKAGE_RPM="$PACKAGE_ROOT/rpm/clang-ocl" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -VALID_STR=`getopt -o hcraso:g: --long help,clean,release,clean,static,address_sanitizer,outdir:,gpu_list: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - MAKEARG="$MAKEARG BUILD_TYPE=rel" ; BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-g | --gpu_list ) - GPU_LIST=$2; shift 2 ;; - --) shift; break;; - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_clang-ocl() { - echo "Removing clang-ocl" - rm -rf $CLANG_OCL_DEST/clang-ocl - rm -rf $CLANG_OCL_BUILD_DIR - rm -rf $CLANG_OCL_PACKAGE_DEB - rm -rf $CLANG_OCL_PACKAGE_RPM -} - -build_clang-ocl() { - if [ ! -d "$CLANG_OCL_BUILD_DIR" ]; then - mkdir -p $CLANG_OCL_BUILD_DIR - pushd $CLANG_OCL_BUILD_DIR - - if [ -e $PACKAGE_ROOT/lib/bitcode/opencl.amdgcn.bc ]; then - BC_DIR="$ROCM_INSTALL_PATH/lib" - else - BC_DIR="$ROCM_INSTALL_PATH/amdgcn/bitcode" - fi - - cmake \ - $(rocm_cmake_params) \ - -DDISABLE_CHECKS="ON" \ - -DCLANG_BIN="$ROCM_INSTALL_PATH/llvm/bin" \ - -DBITCODE_DIR="$BC_DIR" \ - $(rocm_common_cmake_params) \ - -DCPACK_SET_DESTDIR="OFF" \ - $CLANG_OCL_SRC_ROOT - - echo "Making clang-ocl:" - cmake --build . -- $MAKEARG - cmake --build . -- $MAKEARG install - cmake --build . -- $MAKEARG package - popd - fi - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$CLANG_OCL_PACKAGE_DEB" $CLANG_OCL_BUILD_DIR/rocm-clang-ocl*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$CLANG_OCL_PACKAGE_RPM" $CLANG_OCL_BUILD_DIR/rocm-clang-ocl*.rpm -} - - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${CLANG_OCL_PACKAGE_DEB};; - ("rpm") - echo ${CLANG_OCL_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) clean_clang-ocl ;; - (build) build_clang-ocl ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" -exit 0 - diff --git a/tools/rocm-build/build_comgr.sh b/tools/rocm-build/build_comgr.sh deleted file mode 100755 index 78b15b3ed..000000000 --- a/tools/rocm-build/build_comgr.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of comgr. It needs to be used along with -r option" - echo " -l, --link_llvm_static Link to LLVM statically. Default is to dynamically link to LLVM; requires that LLVM dylibs are created." - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME=amd_comgr -PROJ_NAME=$API_NAME -LIB_NAME=lib${API_NAME} -TARGET=build -MAKETARGET=deb -PACKAGE_ROOT=$(getPackageRoot) -PACKAGE_LIB=$(getLibPath) -PACKAGE_INCLUDE=$(getIncludePath) -BUILD_DIR=$(getBuildPath $API_NAME) -PACKAGE_DEB=$PACKAGE_ROOT/deb/$PROJ_NAME -PACKAGE_RPM=$PACKAGE_ROOT/rpm/$PROJ_NAME -PACKAGE_PREFIX=$ROCM_INSTALL_PATH -BUILD_TYPE=Debug -MAKE_OPTS="$DASH_JAY CTEST_OUTPUT_ON_FAILURE=1 -C $BUILD_DIR" -VERBOSE_OPTS="AMD_COMGR_EMIT_VERBOSE_LOGS=1 AMD_COMGR_REDIRECT_LOGS=stdout" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -# link to LLVM dynamicaly. Default is to link to llvm dynamically. -# temporarily set this default to OFF until we resolve Issues -LINK_LLVM_DYLIB="OFF" - -#parse the arguments -VALID_STR=`getopt -o hcraswlo:p: --long help,clean,release,address_sanitizer,static,wheel,link_llvm_static,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-l | --link_llvm_static) - LINK_LLVM_DYLIB="OFF"; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - - rm -rf $BUILD_DIR - rm -rf $PACKAGE_DEB - rm -rf $PACKAGE_RPM - rm -rf $PACKAGE_ROOT/${PROJ_NAME} - rm -rf $PACKAGE_LIB/${LIB_NAME}* -} - -build() { - echo "Building $PROJ_NAME" - - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - if [ "$SHARED_LIBS" == "OFF" ] - then - echo " Building Archive " - else - echo " Building Shared Object " - fi - -# Remove CTEST var once SWDEV-381396 is fixed - cmake \ - $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_common_cmake_params) \ - -DCMAKE_DISABLE_FIND_PACKAGE_hip=TRUE \ - -DCMAKE_CTEST_ARGUMENTS="--exclude-regex;multithread_test" \ - -DLLVM_LINK_LLVM_DYLIB=$LINK_LLVM_DYLIB \ - -DLLVM_ENABLE_LIBCXX=$LINK_LLVM_DYLIB \ - $COMGR_ROOT - - popd - cmake --build "$BUILD_DIR" -- $MAKE_OPTS - cmake --build "$BUILD_DIR" -- $MAKE_OPTS $VERBOSE_OPTS test - cmake --build "$BUILD_DIR" -- $MAKE_OPTS install - cmake --build "$BUILD_DIR" -- $MAKE_OPTS package - - mkdir -p $PACKAGE_LIB - cp -R $BUILD_DIR/${LIB_NAME}* $PACKAGE_LIB - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" $BUILD_DIR/comgr*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" $BUILD_DIR/comgr*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} -verifyEnvSetup - -case $TARGET in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_composable_kernel.sh b/tools/rocm-build/build_composable_kernel.sh deleted file mode 100755 index 7fbebfb4f..000000000 --- a/tools/rocm-build/build_composable_kernel.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -# Temporarily disable Address Sanitizer -ENABLE_ADDRESS_SANITIZER=false - -set_component_src composable_kernel -disable_debug_package_generation -# Set the GPU_ARCH_LIST to the supported GPUs needed after https://github.com/ROCm/composable_kernel/pull/1536/ -GPU_ARCH_LIST="gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201" - -build_miopen_ck() { - echo "Start Building Composable Kernel" - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - GPU_ARCH_LIST="gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+" - else - unset_asan_env_vars - set_address_sanitizer_off - fi - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - GPU_ARCH_LIST="gfx942" - ack_and_skip_static - fi - # if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GPU_ARCH_LIST to that value - # This needs to be removed when CK aligns with other component and uses -DAMDGPU_TARGET or _DGPO_TARGET - # then we can use set_gpu_arch from compure_helper.sh and get rid of all if clauses - if [ -n "$ENABLE_GPU_ARCH" ]; then - GPU_ARCH_LIST="$ENABLE_GPU_ARCH" - fi - # Latest CK requiring Python 3.8 as the minimum. - # Point CMake to that explicit location and adjust LD_LIBRARY_PATH. - PYTHON_VERSION_WORKAROUND='' - echo "DISTRO_ID: ${DISTRO_ID}" - if [ "$DISTRO_ID" = "rhel-8.8" ] || [ "$DISTRO_NAME" == "sles" ] || [ "$DISTRO_ID" = "debian-10" ]; then - EXTRA_PYTHON_PATH=/opt/Python-3.8.13 - PYTHON_VERSION_WORKAROUND="-DCK_USE_ALTERNATIVE_PYTHON=${EXTRA_PYTHON_PATH}/bin/python3.8" - # For the python interpreter we need to export LD_LIBRARY_PATH. - export LD_LIBRARY_PATH=${EXTRA_PYTHON_PATH}/lib:$LD_LIBRARY_PATH - fi - - cd $COMPONENT_SRC - mkdir "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - cmake \ - -DBUILD_DEV=OFF \ - "${rocm_math_common_cmake_params[@]}" \ - ${PYTHON_VERSION_WORKAROUND} \ - -DCPACK_GENERATOR="${PKGTYPE^^}" \ - -DCMAKE_CXX_COMPILER=$(set_build_variables __CLANG++__) \ - -DCMAKE_C_COMPILER=$(set_build_variables __CLANG__) \ - ${LAUNCHER_FLAGS} \ - -DGPU_ARCHS="${GPU_ARCH_LIST}" \ - "$COMPONENT_SRC" - - cmake --build . -- -j${PROC} package - cmake --build "$BUILD_DIR" -- install - - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" -} - -# Use the function to unset the LDFLAGS and CXXFLAGS -# specifically set for ASAN -unset_asan_env_vars() { - ASAN_CMAKE_PARAMS="false" - export ADDRESS_SANITIZER="OFF" - export LD_LIBRARY_PATH="" - export ASAN_OPTIONS="" -} - -set_address_sanitizer_off() { - export CFLAGS="" - export CXXFLAGS="" - export LDFLAGS="" -} - -clean_miopen_ck() { - echo "Cleaning MIOpen-CK build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_miopen_ck; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_miopen_ck ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_dbgapi.sh b/tools/rocm-build/build_dbgapi.sh deleted file mode 100755 index 9b649f755..000000000 --- a/tools/rocm-build/build_dbgapi.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash -source "${BASH_SOURCE%/*}/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE[0]}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " --enable-assertions Enable assertions" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -w, --wheel Creates python wheel package of dbgapi. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -M, --skip_man_pages Do not build the 'docs' target" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME=rocm-dbgapi -AMD_DBGAPI_NAME=amd-dbgapi -MAKEINSTALL_MANIFEST=makeinstall_manifest.txt -PROJ_NAME=$API_NAME -LIB_NAME=lib${API_NAME}.so -TARGET=build -MAKETARGET=deb -PACKAGE_ROOT=$(getPackageRoot) -PACKAGE_LIB=$(getLibPath) -PACKAGE_INCLUDE=$(getIncludePath) -BUILD_DIR=$(getBuildPath $API_NAME) -PACKAGE_DEB=$(getPackageRoot)/deb/$PROJ_NAME -PACKAGE_RPM=$(getPackageRoot)/rpm/$PROJ_NAME -#PACKAGE_PREFIX=$ROCM_INSTALL_PATH -BUILD_TYPE=Debug -MAKE_OPTS=($DASH_JAY -C "$BUILD_DIR") # Note that DASH_JAY might have a space after the -j -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" -DODOCSBUILD=true - -#parse the arguments -VALID_STR=$(getopt -o hcraswo:p:M --long help,clean,release,enable-assertions,static,wheel,address_sanitizer,outdir:,package:skip_man_pages -- "$@") -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ;; - (-r | --release) - ENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-"Off"} ; - BUILD_TYPE="RelWithDebInfo" ;; - ( --enable-assertions) - ENABLE_ASSERTIONS="On" ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - WHEEL_PACKAGE=true ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; ((CLEAN_OR_OUT|=2)) ; shift 1 ;; - (-M | --skip_man_pages) DODOCSBUILD=false;; - (-p | --package) - MAKETARGET="$2" ; shift 1;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - shift - -done - -check_conflicting_options $CLEAN_OR_OUT "$PKGTYPE" "$MAKETARGET" -if [ "$RET_CONFLICT" -ge 30 ]; then - print_vars "$API_NAME" "$TARGET" "$BUILD_TYPE" "$SHARED_LIBS" "$CLEAN_OR_OUT" "$PKGTYPE" "$MAKETARGET" - exit "$RET_CONFLICT" -fi - -clean() { - echo "Cleaning $PROJ_NAME" - if [ -e "$BUILD_DIR/$MAKEINSTALL_MANIFEST" ] ; then - xargs rm -f < "$BUILD_DIR/$MAKEINSTALL_MANIFEST" - fi - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "${PACKAGE_ROOT:?}/${PROJ_NAME}" - rm -rf "${PACKAGE_LIB:?}/${LIB_NAME}"* - rm -rf "${PACKAGE_LIB:?}/cmake/${AMD_DBGAPI_NAME}" - rm -rf "${PACKAGE_INCLUDE:?}/${AMD_DBGAPI_NAME}" -} - -build() { - if [ ! -e "$ROCM_DBGAPI_ROOT/CMakeLists.txt" ] - then - echo " No $ROCM_DBGAPI_ROOT/CMakeLists.txt file, skipping rocm-dbgapi" >&2 - echo " No $ROCM_DBGAPI_ROOT/CMakeLists.txt file, skipping rocm-dbgapi" - exit 0 # THis is not an error - fi - echo "Building $PROJ_NAME" - - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" || exit 99 - - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-"On"} \ - "$ROCM_DBGAPI_ROOT" - - popd || exit 99 - cmake --build "$BUILD_DIR" -- "${MAKE_OPTS[@]}" - "$DODOCSBUILD" && cmake --build "$BUILD_DIR" -- "${MAKE_OPTS[@]}" doc - cmake --build "$BUILD_DIR" -- "${MAKE_OPTS[@]}" install - #install_manifest.txt is created by make install and make package with same name unless - #component packaging is enabled. To avoid overwriting by make package,move the manifest file - #to a different name and can be used for build clean up - mv "$BUILD_DIR/install_manifest.txt" "$BUILD_DIR/$MAKEINSTALL_MANIFEST" - cmake --build "$BUILD_DIR" -- "${MAKE_OPTS[@]}" package - - mkdir -p "$PACKAGE_LIB" - # handle the library being in more than one place to avoid breaking the build. - ( - shopt -s nullglob - cp -R "$BUILD_DIR/lib/${LIB_NAME}"* "$BUILD_DIR/${LIB_NAME}"* "$PACKAGE_LIB" - ) - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME";; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_devicelibs.sh b/tools/rocm-build/build_devicelibs.sh deleted file mode 100755 index 53ff2d6b8..000000000 --- a/tools/rocm-build/build_devicelibs.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Build a release version of the package" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of devicelibs. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo - - return 0 -} -PROJ_NAME="devicelibs" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_BIN="$(getBinPath)" -PACKAGE_LIB="$(getLibPath)" -BUILD_PATH="$(getBuildPath $PROJ_NAME)" -INSTALL_PATH="$(getPackageRoot)" -LIGHTNING_BUILD_PATH="$(getBuildPath lightning)" -DEB_PATH="$(getDebPath devicelibs)" -RPM_PATH="$(getRpmPath devicelibs)" -AMDGCN_LIB_PATH="$PACKAGE_ROOT/amdgcn/bitcode/" - -TARGET="build" -MAKEOPTS="$DASH_JAY" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -#parse the arguments -VALID_STR=`getopt -o hcraswo: --long help,clean,release,static,wheel,address_sanitizer,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - ASAN_CMAKE_PARAMS="true" - ack_and_ignore_asan ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_devicelibs() { - # Delete cmake output directory - rm -rf "$BUILD_PATH" - # Delete the *.bc files from the PACKAGE_LIB directory - rm -f $PACKAGE_LIB/hc*.bc - rm -f $PACKAGE_LIB/irif*.bc - rm -f $PACKAGE_LIB/ockl*.bc - rm -f $PACKAGE_LIB/oclc*.bc - rm -f $PACKAGE_LIB/ocml*.bc - rm -f $PACKAGE_LIB/opencl*.bc - rm -f $PACKAGE_LIB/openmp*.bc - rm -rf $PACKAGE_ROOT/amdgcn - # Delete any packages generated - rm -rf "$DEB_PATH" - rm -rf "$RPM_PATH" -} - -build_devicelibs() { - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - - local clangResourceDir="$($LIGHTNING_BUILD_PATH/bin/clang -print-resource-dir)" - local clangResourceVer=${clangResourceDir#*lib/clang/} - local bitcodeInstallLoc="lib/llvm/lib/clang/${clangResourceVer}/lib" - - export LLVM_BUILD="$LIGHTNING_BUILD_PATH" - if [ ! -e Makefile ]; then - cmake $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - ${GEN_NINJA} \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW="$bitcodeInstallLoc/amdgcn" \ - -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD="amdgcn" \ - "$DEVICELIBS_ROOT" - - echo "CMake complete" - fi - - echo "Building device-libs" - cmake --build . -- $MAKEOPTS - cmake --build . -- $MAKEOPTS install - popd -} - -package_devicelibs() { - mkdir -p "$DEB_PATH" - mkdir -p "$RPM_PATH" - pushd "$BUILD_PATH" - cpack - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$DEB_PATH" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$RPM_PATH" *.rpm - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} -case $TARGET in - (clean) clean_devicelibs ;; - (build) build_devicelibs; package_devicelibs; build_wheel "$BUILD_PATH" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_half.sh b/tools/rocm-build/build_half.sh deleted file mode 100755 index 2d4aeddca..000000000 --- a/tools/rocm-build/build_half.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src half - -build_half() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # ASAN packaging is not required for HALF, since its header only package - # Setting the asan_cmake_params to false will disable ASAN packaging - ASAN_CMAKE_PARAMS="false" - fi - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - cmake \ - -DCMAKE_INSTALL_PREFIX="$ROCM_PATH" \ - -DCPACK_PACKAGING_INSTALL_PREFIX=${ROCM_PATH}\ - -DCPACK_SET_DESTDIR="OFF" \ - -DCPACK_RPM_PACKAGE_RELOCATABLE="ON" \ - -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- package - cmake --build "$BUILD_DIR" -- install - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_half() { - echo "Cleaning half build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_half; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_half ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hip_on_rocclr.sh b/tools/rocm-build/build_hip_on_rocclr.sh deleted file mode 100755 index 3d8c6cc82..000000000 --- a/tools/rocm-build/build_hip_on_rocclr.sh +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/bash - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -h, --help Prints this help" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of hip-on-rocclr. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -t, --offload-arch= Specify arch for catch tests ex: --offload-arch=gfx1030 --offload-arch=gfx1100" - echo " -p, --package Specify packaging format" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -MAKEOPTS="$DASH_JAY" -PROJ_NAME="hip-on-rocclr" -BUILD_PATH="$(getBuildPath $PROJ_NAME)" - -TARGET="build" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_SRC="$(getSrcPath)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -PREFIX_PATH="$PACKAGE_ROOT" -CORE_BUILD_DIR="$(getBuildPath hsa-core)" -ROCclr_BUILD_DIR="$(getBuildPath rocclr)" -HIPCC_BUILD_DIR="$(getBuildPath hipcc)" -CATCH_BUILD_DIR="$(getBuildPath catch)" -CATCH_SRC="$HIP_CATCH_TESTS_ROOT/catch" -SAMPLES_SRC="$HIP_CATCH_TESTS_ROOT/samples" -SAMPLES_BUILD_DIR="$(getBuildPath samples)" -if [ ! -e "$CATCH_SRC/CMakeLists.txt" ]; then - echo "Using catch source from hip project" >&2 - CATCH_SRC="$HIP_ON_ROCclr_ROOT/tests/catch" -fi - -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" -OFFLOAD_ARCH=() - -DEFAULT_OFFLOAD_ARCH=(gfx900 gfx906 gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1031 gfx1033 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 gfx1103 gfx1150 gfx1151 gfx1200 gfx1201) - -#parse the arguments -VALID_STR=`getopt -o hcraswt:o: --long help,clean,release,address_sanitizer,static,wheel,offload-arch=:,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-t | --offload-arch=) - OFFLOAD_ARCH+=( "$2" ); ((CLEAN_OR_OUT|=2)); shift 2 ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -if [ ${#OFFLOAD_ARCH[@]} = 0 ] ; then - OFFLOAD_ARCH=( "${DEFAULT_OFFLOAD_ARCH[@]}" ) -else - echo "Using user defined offload archs ${OFFLOAD_ARCH[@]} for catch tests"; -fi -printf -v OFFLOAD_ARCH_STR -- '--offload-arch=%q ' "${OFFLOAD_ARCH[@]}" - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - - -clean_hip_on_rocclr() { - # Delete cmake output directory - rm -rf "$BUILD_PATH" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$OUT_DIR/hip" -} - -build_hip_on_rocclr() { - # TODO This if condition is a temporary workaround so that mainline builds dont error out - # until build migrated from hipamd to clr repo - if [ -e "$CLR_ROOT/CMakeLists.txt" ]; then - # We are in a branch that has migrated to clr repo - _HIP_CMAKELIST_DIR="$CLR_ROOT" - _HIP_CMAKELIST_OPT="-DCLR_BUILD_HIP=ON -DCLR_BUILD_OCL=OFF" - if [ -e "$HIPOTHER_ROOT/hipnv" ]; then - # We are in a branch that has hipnv headers migrated - _HIP_CMAKELIST_OPT="$_HIP_CMAKELIST_OPT -DHIPNV_DIR=$HIPOTHER_ROOT/hipnv" - fi - elif [ ! -e "$HIPAMD_ROOT/CMakeLists.txt" ]; then - # We seem to have hit a branch in which both the old and the new repo don't exist - echo "No $HIPAMD_ROOT/CMakeLists.txt file, skipping hip on rocclr" >&2 - echo "No $HIPAMD_ROOT/CMakeLists.txt file, skipping hip on rocclr" - exit 0 # This is not an error - else - # We are in a branch that has not yet migrated to clr repo yet - _HIP_CMAKELIST_DIR="$HIPAMD_ROOT" - _HIP_CMAKELIST_OPT="" - fi - - echo "$_HIP_CMAKELIST_DIR" - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - - # FIXME: Remove -DROCclr_DIR/LIBROCclr_STATIC_DIR - if [ ! -e Makefile ]; then - echo "Building HIP-On-ROCclr CMake environment" - print_lib_type $SHARED_LIBS - - cmake $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DHIP_COMPILER=clang \ - -DHIP_PLATFORM=amd \ - -DHIP_COMMON_DIR="$HIP_ON_ROCclr_ROOT" \ - $(rocm_common_cmake_params) \ - -DCMAKE_HIP_ARCHITECTURES=OFF \ - -DHSA_PATH="$ROCM_INSTALL_PATH" \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE \ - -DCPACK_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DROCM_PATH="$ROCM_INSTALL_PATH" \ - -DHIPCC_BIN_DIR="$HIPCC_BUILD_DIR" \ - -DHIP_CATCH_TEST=1 \ - $_HIP_CMAKELIST_OPT \ - "$_HIP_CMAKELIST_DIR" - - echo "CMake complete" - fi - - echo "Build and Install HIP" - cmake --build . -- $MAKEOPTS install "VERBOSE=1" - - popd -} - -build_catch_tests() { - WORKSPACE=`pwd` - echo "Build catch2 tests independently" - if [ ! -e "$CATCH_SRC/CMakeLists.txt" ]; then - echo "catch source not found: $CATCH_SRC" >&2 - exit - fi - # build catch - rm -rf "$CATCH_BUILD_DIR" - mkdir -p "$CATCH_BUILD_DIR" - pushd "$CATCH_BUILD_DIR" - # use the newly built hip as HIP for catch - export HIP_PATH="$ROCM_INSTALL_PATH" - export ROCM_PATH="$ROCM_INSTALL_PATH" - # Note: The rocm_common_cmake_params will provide CMAKE_EXE_LINKER_FLAGS_INIT - # for binaries located in /opt/rocm/bin - # hip-catch binaries are located in each test folder under /opt/rocm/share/hip/catch_test/ - # Append the EXE LINKER flags with ROCm library path - cmake \ - -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DHIP_PLATFORM=amd \ - -DROCM_PATH="$ROCM_INSTALL_PATH" \ - -DOFFLOAD_ARCH_STR="$OFFLOAD_ARCH_STR" \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DCPACK_RPM_DEBUGINFO_PACKAGE=FALSE \ - -DCPACK_DEBIAN_DEBUGINFO_PACKAGE=FALSE \ - -DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_EXE_RPATH:$ROCM_INSTALL_PATH/lib:/opt/rocm/lib \ - -DCPACK_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - "$CATCH_SRC" - - - make $MAKEOPTS build_tests - echo "Packaging catch tests" - make $MAKEOPTS package_test - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -package_samples() { - # TODO: To be removed once the issue related to ASAN builds are fixed - if [ "$ASAN_CMAKE_PARAMS" == "true" ] ; then - echo "Disable the packaging of HIP samples" >&2 - return - fi - WORKSPACE=`pwd` - if [ ! -e "$SAMPLES_SRC/CMakeLists.txt" ]; then - echo "HIP samples source not found at: $SAMPLES_SRC" >&2 - echo "Using samples package from hip project: $BUILD_PATH" >&2 - # TODO: change to return failure after hip-tests samples change is available in mainline - return - fi - # package samples - rm -rf "$SAMPLES_BUILD_DIR" - mkdir -p "$SAMPLES_BUILD_DIR" - pushd "$SAMPLES_BUILD_DIR" - # The cmake path is different for asan and non-asan builds. - # Fetch after getting build type. Default will be non-asan build - local CMAKE_PATH="$(getCmakePath)" - # use the newly built hip as HIP for samples - export HIP_PATH="$ROCM_INSTALL_PATH" - export ROCM_PATH="$ROCM_INSTALL_PATH" - cmake \ - -DROCM_PATH="$ROCM_INSTALL_PATH" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DCMAKE_MODULE_PATH="$CMAKE_PATH/hip" \ - -DCPACK_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - "$SAMPLES_SRC" - echo "Packaging hip samples from hip-tests project" - make $MAKEOPTS package_samples - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -clean_hip_tests(){ - rm -rf "$CATCH_BUILD_DIR" - rm -rf "$PACKAGE_SRC/hip-on-rocclr" - rm -rf "$PACKAGE_SRC/hipamd" - rm -rf "$PACKAGE_SRC/rocclr" - rm -rf "$PACKAGE_SRC/opencl-on-rocclr" - rm -rf "$PACKAGE_SRC/clr" - rm -rf "$PACKAGE_SRC/hip-tests" - rm -rf "$PACKAGE_SRC/hipother" -} -copy_hip_tests() { - clean_hip_tests - - echo "Copy HIP & ROCclr Source and tests" - - mkdir -p "$PACKAGE_SRC/hip-on-rocclr" - echo "Copying hip-on-rocclr" - progressCopy "$HIP_ON_ROCclr_ROOT" "$PACKAGE_SRC/hip-on-rocclr" - - if [ -e "$CLR_ROOT/CMakeLists.txt" ]; then - mkdir -p "$PACKAGE_SRC/clr" - echo "Copying clr" - progressCopy "$CLR_ROOT" "$PACKAGE_SRC/clr" - else - mkdir -p "$PACKAGE_SRC/hipamd" - mkdir -p "$PACKAGE_SRC/rocclr" - mkdir -p "$PACKAGE_SRC/opencl-on-rocclr" - echo "Copying hipamd" - progressCopy "$HIPAMD_ROOT" "$PACKAGE_SRC/hipamd" - echo "Copying rocclr" - progressCopy "$ROCclr_ROOT" "$PACKAGE_SRC/rocclr" - echo "Copying opencl-on-rocclr" - progressCopy "$OPENCL_ON_ROCclr_ROOT" "$PACKAGE_SRC/opencl-on-rocclr" - fi - - if [ -e "$HIPOTHER_ROOT/hipnv" ]; then - mkdir -p "$PACKAGE_SRC/hipother" - echo "Copying hipother" - progressCopy "$HIPOTHER_ROOT" "$PACKAGE_SRC/hipother" - fi - - mkdir -p "$PACKAGE_SRC/hip-tests" - echo "Copying hip-tests" - progressCopy "$HIP_CATCH_TESTS_ROOT" "$PACKAGE_SRC/hip-tests" -} - -package_hip_on_rocclr() -{ - echo "Packagin HIP-on-ROCclr" - pushd "$BUILD_PATH" - cmake --build . -- $MAKEOPTS package - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_hip_on_rocclr - clean_hip_tests - ;; - (build) - build_hip_on_rocclr - build_catch_tests - package_hip_on_rocclr - package_samples - build_wheel "$BUILD_PATH" "$PROJ_NAME" - copy_hip_tests - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_hipblas-common.sh b/tools/rocm-build/build_hipblas-common.sh deleted file mode 100755 index 4e03bfe5b..000000000 --- a/tools/rocm-build/build_hipblas-common.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipBLAS-common - -build_hipblas-common() { - echo "Start build" - - CXX=$(set_build_variables __C_++__) - cd $COMPONENT_SRC - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - init_rocm_common_cmake_params - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - "$COMPONENT_SRC" - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_hipblas-common() { - echo "Cleaning hipBLAS-common build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipblas-common; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipblas-common ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipblas.sh b/tools/rocm-build/build_hipblas.sh deleted file mode 100755 index bbcb2c8f8..000000000 --- a/tools/rocm-build/build_hipblas.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipBLAS - -build_hipblas() { - echo "Start build" - - CXX=$(set_build_variables __G_++__) - CXX_FLAG= - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - CXX=$(set_build_variables __AMD_CLANG_++__) - CXX_FLAG=$(set_build_variables __CMAKE_CXX_PARAMS__) - fi - - CLIENTS_SAMPLES="ON" - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # fixme: remove CLIENTS_SAMPLES=OFF once SWDEV-417076 is fixed - CLIENTS_SAMPLES="OFF" - fi - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - echo "FC compiler: $FC" - - cd $COMPONENT_SRC - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - rebuild_lapack - fi - - init_rocm_common_cmake_params - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DUSE_CUDA=OFF \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DBUILD_CLIENTS_SAMPLES="${CLIENTS_SAMPLES}" \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - ${CXX_FLAG} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipblas() { - echo "Cleaning hipBLAS build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipblas; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipblas ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipblaslt.sh b/tools/rocm-build/build_hipblaslt.sh deleted file mode 100755 index 816866145..000000000 --- a/tools/rocm-build/build_hipblaslt.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipBLASLt - -#not enabling the debug files by defalut -disable_debug_package_generation -# if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value -if [ -n "$ENABLE_GPU_ARCH" ]; then - set_gpu_arch "$ENABLE_GPU_ARCH" -else - # gfx90a:xnack+;gfx90a:xnack-;gfx940;gfx941;gfx942 - set_gpu_arch "all" -fi - -build_hipblaslt() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd $COMPONENT_SRC - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - # hipblaslt requiring Python 3.12. - # Point CMake to that explicit location and adjust LD_LIBRARY_PATH. - if [ "$DISTRO_ID" = "rhel-8.8" ] || [ "$DISTRO_NAME" == "sles" ] || \ - [ "$DISTRO_ID" = "rhel-9.1" ] || [ "$DISTRO_ID" = "almalinux-8.10" ] || \ - [ "$DISTRO_ID" = "debian-10" ]; then - EXTRA_PYTHON_PATH=/opt/Python-3.12.7 - EXTRA_CMAKE_OPTIONS="-DPython_ROOT=/opt/Python-3.12.7" - export LD_LIBRARY_PATH=${EXTRA_PYTHON_PATH}/lib - fi - - init_rocm_common_cmake_params - CXX=$(set_build_variables __CXX__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DTensile_LOGIC= \ - -DTensile_CODE_OBJECT_VERSION=default \ - -DTensile_CPU_THREADS=$((PROC / 4)) \ - -DTensile_LIBRARY_FORMAT=msgpack \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DLINK_BLIS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - ${EXTRA_CMAKE_OPTIONS} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_hipblaslt() { - echo "Cleaning hipBLASLt build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipblaslt; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipblaslt ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipcc.sh b/tools/rocm-build/build_hipcc.sh deleted file mode 100755 index 20a011f9e..000000000 --- a/tools/rocm-build/build_hipcc.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -w, --wheel Creates python wheel package of hipcc. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -r, --release Makes a release build" - echo " -h, --help Prints this help" - echo - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo - - return 0 -} - - -## Build environment variables -API_NAME=hipcc -PROJ_NAME=$API_NAME - -TARGET="build" -MAKEOPTS="$DASH_JAY" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -BUILD_DIR=$(getBuildPath $API_NAME) -PACKAGE_DEB=$(getPackageRoot)/deb/$PROJ_NAME -PACKAGE_RPM=$(getPackageRoot)/rpm/$PROJ_NAME -PACKAGE_SRC="$(getSrcPath)" - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,address_sanitizer,static,outdir,wheel:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-a | --address_sanitizer) - ack_and_ignore_asan ;; - (-c | --clean) - TARGET="clean" ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 1 ;; - (-w | --wheel) - WHEEL_PACKAGE=true ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ;; - (-s | --static) - SHARED_LIBS="OFF" ;; - (-h | --help) - printUsage ; exit 0 ;; - --) shift; break;; # end delimiter - (*) - echo "Invalid option [$1]" >&2; printUsage; exit 1 ;; - esac - shift 1 -done - -clean() { - echo "Cleaning hipcc" - rm -rf $BUILD_DIR - - echo "Cleaning up hipcc DEB and RPM packages" - rm -rf $PACKAGE_DEB - rm -rf $PACKAGE_RPM -} - -copy_hipcc_sources() { - echo "Clean up hipcc build folder" - rm -rf "$PACKAGE_SRC/hipcc" - echo "Copy hipcc sources" - mkdir -p "$PACKAGE_SRC/hipcc" - progressCopy "$HIPCC_ROOT" "$PACKAGE_SRC/hipcc" -} - -build() { - echo "Build hipcc binary" - mkdir -p "$BUILD_DIR" - - pushd "$BUILD_DIR" - if ! [ -e "$HIPCC_ROOT/CMakeLists.txt" ] ; then - - echo "No source for hipcc, exiting. this is not an error" >&2 - exit 0 - fi - - cmake \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DHIPCC_BACKWARD_COMPATIBILITY=OFF \ - -DCMAKE_INSTALL_PREFIX="$ROCM_PATH" \ - $HIPCC_ROOT - popd - - cmake --build "$BUILD_DIR" -- $MAKEOPTS - - echo "Installing and Packaging hipcc" - cmake --build "$BUILD_DIR" -- $MAKEOPTS install - cmake --build "$BUILD_DIR" -- $MAKEOPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" $BUILD_DIR/hipcc*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" $BUILD_DIR/hipcc*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1 ;; - esac - exit -} - -case $TARGET in - (clean) - clean - ;; - (build) - build - build_wheel "$BUILD_DIR" "$PROJ_NAME" - copy_hipcc_sources - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_hipcub.sh b/tools/rocm-build/build_hipcub.sh deleted file mode 100755 index 3aa472f65..000000000 --- a/tools/rocm-build/build_hipcub.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipCUB - -build_hipcub() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # ASAN packaging is not required for HIPCUB, since its header only package - # Setting the asan_cmake_params to false will disable ASAN packaging - ASAN_CMAKE_PARAMS="false" - fi - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - CXX=$(set_build_variables __CXX__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - -Drocprim_DIR="${ROCM_PATH}/rocprim" \ - -DBUILD_TEST=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipcub() { - echo "Cleaning hipCUB build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipcub; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipcub ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipfft.sh b/tools/rocm-build/build_hipfft.sh deleted file mode 100755 index 14db98553..000000000 --- a/tools/rocm-build/build_hipfft.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipFFT - -build_hipfft() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd $COMPONENT_SRC - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - cmake \ - "$(set_build_variables __CMAKE_CXX_PARAMS__)" \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip" \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -L \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipfft() { - echo "Cleaning hipFFT build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipfft; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipfft ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipfort.sh b/tools/rocm-build/build_hipfort.sh deleted file mode 100755 index 288007be2..000000000 --- a/tools/rocm-build/build_hipfort.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipfort - -build_hipfort() { - echo "Start build" - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - cmake \ - -DCPACK_PACKAGING_INSTALL_PREFIX=${ROCM_PATH}\ - -DHIPFORT_INSTALL_DIR="${ROCM_PATH}" \ - -DCMAKE_PREFIX_PATH="${ROCM_PATH}/llvm;${ROCM_PATH}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCPACK_SET_DESTDIR="OFF" \ - -DCPACK_RPM_PACKAGE_RELOCATABLE="ON" \ - -DHIPFORT_COMPILER="${ROCM_PATH}/${ROCM_LLVMDIR}/bin/flang" \ - -DCMAKE_Fortran_FLAGS="-Mfree" \ - -DHIPFORT_COMPILER_FLAGS="-cpp" \ - -DCMAKE_Fortran_FLAGS_DEBUG="" \ - ${LAUNCHER_FLAGS} \ - -DROCM_SYMLINK_LIBS=OFF \ - -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} \ - -DHIPFORT_AR="${ROCM_PATH}/${ROCM_LLVMDIR}/bin/llvm-ar" \ - -DHIPFORT_RANLIB="${ROCM_PATH}/${ROCM_LLVMDIR}/bin/llvm-ranlib" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipfort() { - echo "Cleaning hipFORT build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipfort; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipfort ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipify_clang.sh b/tools/rocm-build/build_hipify_clang.sh deleted file mode 100755 index 21c80bfe0..000000000 --- a/tools/rocm-build/build_hipify_clang.sh +++ /dev/null @@ -1,211 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -r, --release Make a release build" - echo " -n, --skip_hipify_tests Skip hipify-clang testing" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -i, --clang_headers Install clang headers" - echo " -w, --wheel Creates python wheel package of hipify-clang. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - - return 0 -} - -# Build Environmental Variables -PROJ_NAME="hipify" -TARGET="build" -MAKEOPTS="$DASH_JAY" -HIPIFY_CLANG_BUILD_DIR="$(getBuildPath $HIPIFY_ROOT)" -BUILD_TYPE="Debug" -PACKAGE_ROOT="$(getPackageRoot)" -HIPIFY_CLANG_HASH="" -LIGHTNING_PATH="$ROCM_INSTALL_PATH/llvm" -LIGHTNING_BUILD_PATH="$PACKAGE_ROOT/build/lightning" -RUN_HIPIFY_TESTS=false -CUDA_DEFAULT_VERSION="12.3.2" -CUDNN_DEFAULT_VERSION="9.2.0" -GCC_MIN_VERSION="9.2" -ADDRESS_SANITIZER=false -INSTALL_CLANG_HEADERS="OFF" -DEB_PATH="$(getDebPath hipify)" -RPM_PATH="$(getRpmPath hipify)" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcrnawsio: --long help,clean,release,skip_hipify_tests,wheel,static,address_sanitizer,clang_headers,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-n | --skip_hipify_tests) - RUN_HIPIFY_TESTS=false; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - ADDRESS_SANITIZER=true ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-i | --clang_headers) - INSTALL_CLANG_HEADERS="ON" ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_hipify() { - echo "Cleaning hipify-clang" - rm -rf "$HIPIFY_CLANG_BUILD_DIR" - rm -rf "$DEB_PATH" - rm -rf "$RPM_PATH" -} - -package_hipify() { - # set-up dirs - if [ "$PACKAGEEXT" = "deb" ]; then - rm -rf "$DEB_PATH" - mkdir -p "$DEB_PATH" - fi - - if [ "$PACKAGEEXT" = "rpm" ]; then - rm -rf "$RPM_PATH" - mkdir -p "$RPM_PATH" - fi - - # make the pkg - pushd "$HIPIFY_CLANG_BUILD_DIR" - make $MAKEOPTS package_hipify-clang - popd - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$DEB_PATH" $HIPIFY_CLANG_BUILD_DIR/hipify*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$RPM_PATH" $HIPIFY_CLANG_BUILD_DIR/hipify*.rpm -} - -build_hipify() { - echo "Building hipify-clang binaries" - mkdir -p "$HIPIFY_CLANG_BUILD_DIR" - - pushd "$HIPIFY_CLANG_BUILD_DIR" - - # Check the installed GCC version - INSTALLED_GCC_VERSION=$(gcc --version | head -n 1 | sed -E 's/[^0-9]*([0-9]+\.[0-9]+).*/\1/') - if echo "$INSTALLED_GCC_VERSION $GCC_MIN_VERSION" | awk '{exit !($1 < $2)}'; then - RUN_HIPIFY_TESTS=false - echo "Minimum required GCC version: $GCC_MIN_VERSION" - echo "Installed GCC version $INSTALLED_GCC_VERSION does not meet the minimum GCC version requirement." - echo "Skipping hipify tests" - fi - - if $ADDRESS_SANITIZER ; then - echo "Skipping hipify tests becasue of Address Sanitizer" - RUN_HIPIFY_TESTS=false - fi - - if $RUN_HIPIFY_TESTS ; then - # TODO: Add option for user defined cuda version? - CUDA_VERSION="${CUDA_DEFAULT_VERSION}" - CUDNN_VERSION="${CUDNN_DEFAULT_VERSION}" - - if [[ "$DISTRO_ID" == "rhel-8"* || "$DISTRO_NAME" == "sles" || "$DISTRO_ID" == "debian-10" ]]; then - EXTRA_PYTHON_PATH=/opt/Python-3.8.13 - export LD_LIBRARY_PATH=${EXTRA_PYTHON_PATH}/lib:$LD_LIBRARY_PATH - fi - - echo "Copy FileCheck into ROCM_INSTALL_PATH" - cp "$LIGHTNING_BUILD_PATH/bin/FileCheck" "$LIGHTNING_PATH/bin/FileCheck" - fi - - cmake \ - -DHIPIFY_CLANG_TESTS="$RUN_HIPIFY_TESTS" \ - -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ - $(rocm_common_cmake_params) \ - -DCMAKE_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_PACKAGING_INSTALL_PREFIX=$ROCM_INSTALL_PATH \ - -DCMAKE_PREFIX_PATH="$LIGHTNING_PATH" \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DHIPIFY_INSTALL_CLANG_HEADERS="$INSTALL_CLANG_HEADERS" \ - -DCUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-${CUDA_DEFAULT_VERSION}" \ - -DCUDA_DNN_ROOT_DIR="/usr/local/cuDNN/${CUDNN_DEFAULT_VERSION}" \ - -DCUDA_CUB_ROOT_DIR="/usr/local/cuda-${CUDA_DEFAULT_VERSION}" \ - -DLLVM_EXTERNAL_LIT="${LIGHTNING_BUILD_PATH}/bin/llvm-lit" \ - $HIPIFY_ROOT - - if $RUN_HIPIFY_TESTS ; then - echo "Running hipify tests" - cmake --build . -- $MAKEOPTS test-hipify - fi - - cmake --build . -- $MAKEOPTS install - popd - - pushd "$HIPIFY_ROOT" - HIPIFY_CLANG_HASH=`git describe --dirty --long --match [0-9]* --always` - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_hipify - ;; - (build) - build_hipify - package_hipify - build_wheel "$HIPIFY_CLANG_BUILD_DIR" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_hiprand.sh b/tools/rocm-build/build_hiprand.sh deleted file mode 100755 index e40564dc7..000000000 --- a/tools/rocm-build/build_hiprand.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipRAND - -while [ "$1" != "" ]; -do - case $1 in - -o | --outdir ) - shift 1; PKGTYPE=$1 ; TARGET="outdir" ;; - -c | --clean ) - TARGET="clean" ;; - *) - break ;; - esac - shift 1 -done - -build_hiprand() { - echo "Start build" - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd $COMPONENT_SRC - - remote_name=$(git remote show | head -n 1) - [ "$remote_name" == "origin" ] || git remote rename "$remote_name" origin - git submodule update --init --force - - mkdir "$BUILD_DIR" && cd "$BUILD_DIR" - - init_rocm_common_cmake_params - - CXX=$(set_build_variables __CXX__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DBUILD_TEST=ON \ - -DBUILD_BENCHMARK=ON \ - -DBUILD_CRUSH_TEST=ON \ - -DDEPENDENCIES_FORCE_DOWNLOAD=ON \ - -DHIP_COMPILER=clang \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip" \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" -} - -clean_hiprand() { - echo "Cleaning hipRAND build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - build) build_hiprand; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hiprand ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipsolver.sh b/tools/rocm-build/build_hipsolver.sh deleted file mode 100755 index 161a4397c..000000000 --- a/tools/rocm-build/build_hipsolver.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipSOLVER - -build_hipsolver() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - CXX_FLAG=$(set_build_variables __CMAKE_CXX_PARAMS__) - fi - - cd $COMPONENT_SRC - - CXX=$(set_build_variables __AMD_CLANG_++__) - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - echo "FC compiler: $FC" - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - rebuild_lapack - fi - - init_rocm_common_cmake_params - cmake \ - -DUSE_CUDA=OFF \ - -DCMAKE_CXX_COMPILER=${CXX} \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - ${CXX_FLAG} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipsolver() { - echo "Cleaning hipSOLVER build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipsolver; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipsolver ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipsparse.sh b/tools/rocm-build/build_hipsparse.sh deleted file mode 100755 index 447df6852..000000000 --- a/tools/rocm-build/build_hipsparse.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -PATH=${ROCM_PATH}/bin:$PATH -set_component_src hipSPARSE - -build_hipsparse() { - echo "Start build" - - CXX=$(set_build_variables __G_++__) - CXX_FLAG= - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - CXX=$(set_build_variables __CXX__) - CXX_FLAG=$(set_build_variables __CMAKE_CXX_PARAMS__) - fi - - cd $COMPONENT_SRC - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DUSE_CUDA=OFF \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - ${CXX_FLAG} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hipsparse() { - echo "Cleaning hipSPARSE build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hipsparse; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipsparse ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hipsparselt.sh b/tools/rocm-build/build_hipsparselt.sh deleted file mode 100755 index a7c1b63c7..000000000 --- a/tools/rocm-build/build_hipsparselt.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipSPARSELt - -disable_debug_package_generation -# if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value -if [ -n "$ENABLE_GPU_ARCH" ]; then - set_gpu_arch "$ENABLE_GPU_ARCH" -else - # gfx90a:xnack+;gfx90a:xnack-;gfx940;gfx941;gfx942 - set_gpu_arch "all" -fi -while [ "$1" != "" ]; -do - case $1 in - -o | --outdir ) - shift 1; PKGTYPE=$1 ; TARGET="outdir" ;; - -c | --clean ) - TARGET="clean" ;; - *) - break ;; - esac - shift 1 -done - -create_blis_link() -{ - #find the pre-installed blis library and create the link under $BUILD_DIR/deps/blis - BLIS_REF_ROOT="$BUILD_DIR/deps/blis" - mkdir -p "$BLIS_REF_ROOT"/include - if [[ -e "/opt/AMD/aocl/aocl-linux-gcc-4.2.0/gcc/lib_ILP64/libblis-mt.a" ]]; then - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.2.0/gcc/include_ILP64 ${BLIS_REF_ROOT}/include/blis - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.2.0/gcc/lib_ILP64 ${BLIS_REF_ROOT}/lib - elif [[ -e "/opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc/lib_ILP64/libblis-mt.a" ]]; then - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc/include_ILP64 ${BLIS_REF_ROOT}/include/blis - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.1.0/gcc/lib_ILP64 ${BLIS_REF_ROOT}/lib - elif [[ -e "/opt/AMD/aocl/aocl-linux-gcc-4.0.0/gcc/lib_ILP64/libblis-mt.a" ]]; then - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.0.0/gcc/include_ILP64 ${BLIS_REF_ROOT}/include/blis - ln -sf /opt/AMD/aocl/aocl-linux-gcc-4.0.0/gcc/lib_ILP64 ${BLIS_REF_ROOT}/lib - elif [[ -e "/usr/local/lib/libblis.a" ]]; then - ln -sf /usr/local/include/blis ${BLIS_REF_ROOT}/include/blis - ln -sf /usr/local/lib ${BLIS_REF_ROOT}/lib - else - echo "error: BLIS lib not found." - fi -} - -build_hipsparselt() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd $COMPONENT_SRC - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - create_blis_link - EXTRA_CMAKE_OPTIONS="-DLINK_BLIS=ON -DBUILD_DIR=${BUILD_DIR}" - fi - - init_rocm_common_cmake_params - - CXX=$(set_build_variables __CXX__) \ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DTensile_LOGIC= \ - -DTensile_CODE_OBJECT_VERSION=default \ - -DTensile_CPU_THREADS= \ - -DTensile_LIBRARY_FORMAT=msgpack \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - ${EXTRA_CMAKE_OPTIONS} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - $SCCACHE_BIN -s || echo "Unable to display sccache stats" -} - -clean_hipsparselt() { - echo "Cleaning hipSPARSELt build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - build) build_hipsparselt; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hipsparselt ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hiptensor.sh b/tools/rocm-build/build_hiptensor.sh deleted file mode 100755 index 77d2ac8b2..000000000 --- a/tools/rocm-build/build_hiptensor.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src hipTensor -disable_debug_package_generation - -build_hiptensor() { - echo "Start build hipTensor" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd "$COMPONENT_SRC" - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - cmake \ - -B "${BUILD_DIR}" \ - "${rocm_math_common_cmake_params[@]}" \ - "$(set_build_variables __CMAKE_CC_PARAMS__)" \ - "$(set_build_variables __CMAKE_CXX_PARAMS__)" \ - ${LAUNCHER_FLAGS} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_hiptensor() { - echo "Cleaning hipTensor build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_hiptensor; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_hiptensor ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_hsa.sh b/tools/rocm-build/build_hsa.sh deleted file mode 100755 index 1c8e2c8ea..000000000 --- a/tools/rocm-build/build_hsa.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...] [make options]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of hsa. It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo - - return 0 -} - -PROJ_NAME="rocr" -TARGET="build" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_SRC="$(getSrcPath)" -PACKAGE_LIB="$(getLibPath)" -PACKAGE_BIN="$(getBinPath)" -PACKAGE_DEB="$(getPackageRoot)/deb/$PROJ_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$PROJ_NAME" -MAKEARG="" -CORE_BUILD_DIR="$(getBuildPath hsa-core)" -ROCR_DEV_BUILD_DIR="$(getBuildPath hsa-rocr-dev)" -PREFIX_PATH="$PACKAGE_ROOT" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - -unset HIP_DEVICE_LIB_PATH -unset ROCM_PATH - -#parse the arguments -VALID_STR=`getopt -o hcraswo: --long help,clean,release,static,wheel,address_sanitizer,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_hsa() { - echo "Cleaning HSA" - - rm -rf "$CORE_BUILD_DIR" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_DEB" - rm -f "$PACKAGE_ROOT"/lib/libhsa-runtime* - rm -rf "$PACKAGE_ROOT/lib/cmake/hsa-runtime64" - rm -rf "$PACKAGE_ROOT/include/hsa" - rm -rf "$PACKAGE_ROOT/share/doc/hsa-runtime64" - # Remove when switching to flat directory layout. - rm -rf "$PACKAGE_ROOT/hsa" -} - - -build_hsa_core() { - echo "Build HSA" - local coreMakeOpts="$DASH_JAY -C $CORE_BUILD_DIR" - - echo "$HSA_CORE_ROOT" - - if [ ! -d "$CORE_BUILD_DIR" ]; then - mkdir -p "$CORE_BUILD_DIR" - pushd "$CORE_BUILD_DIR" - print_lib_type $SHARED_LIBS - - cmake $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DENABLE_LDCONFIG=OFF \ - $(rocm_common_cmake_params) \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - "$HSA_CORE_ROOT" - popd - fi - time cmake --build "$CORE_BUILD_DIR" -- $coreMakeOpts - time cmake --build "$CORE_BUILD_DIR" -- $coreMakeOpts install - time cmake --build "$CORE_BUILD_DIR" -- $coreMakeOpts package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" $CORE_BUILD_DIR/hsa-rocr*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" $CORE_BUILD_DIR/hsa-rocr*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_hsa - ;; - (build) - build_hsa_core - build_wheel "$CORE_BUILD_DIR" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_lightning.sh b/tools/rocm-build/build_lightning.sh deleted file mode 100755 index 5126689ae..000000000 --- a/tools/rocm-build/build_lightning.sh +++ /dev/null @@ -1,1397 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -export JOB_DESIGNATOR -export BUILD_ID -export SLES_BUILD_ID_PREFIX -export ROCM_LIBPATCH_VERSION - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -d, --debug Build a debug version of llvm (excludes packaging)" - echo " -r, --release Build a release version of the package" - echo " -a, --address_sanitizer Enable address sanitizer (enabled by default)" - echo " -A --no_address_sanitizer Disable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocm-llvm. It needs to be used along with -r option" - echo " -l, --build_llvm_static Build LLVM libraries statically linked. Default is to build dynamic linked libs" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -B, --build Build and install binary files into /opt/rocm folder" - echo " -P, --package Generate packages" - echo " -N, --skip_lit_tests Skip llvm lit testing (llvm lit testing is enabled by default)" - echo " -M, --skip_man_pages Skip llvm documentation generation (man pages and rocm-llvm-docs package generation is enabled by default)" - echo " --skip_utils Skip installation of LLVM Utils (FileCheck, not, etc.)" - echo " -h, --help Prints this help" - echo " --compiler_rt_debug Build a debug version of runtimes" - echo " --compiler_rt_release Build a release version of runtimes (enabled by default)" - echo - echo - - return 0 -} - -PROJ_NAME="lightning" -ROCM_LLVM_LIB_RPATH='\$ORIGIN' -ROCM_LLVM_EXE_RPATH='\$ORIGIN/../lib:\$ORIGIN/../../../lib' - -PACKAGE_OUT="$(getPackageRoot)" -BUILD_PATH="$(getBuildPath $PROJ_NAME)" -DEB_PATH="$(getDebPath $PROJ_NAME)" -RPM_PATH="$(getRpmPath $PROJ_NAME)" -INSTALL_PATH="${ROCM_INSTALL_PATH}/lib/llvm" -LLVM_ROOT_LCL="${LLVM_ROOT}" - -TARGET="all" -MAKEOPTS="$DASH_JAY" -# Default to build release with Assertions ON -BUILD_TYPE="Release" -COMPILER_RT_DEBUG="OFF" -# Enable assertions for all builds except release, nfar, and afar jobs. -case "${JOB_NAME}" in - ( *"rel"* | \ - *"nfar"* ) - ENABLE_ASSERTIONS=0 ;; - ( * ) - ENABLE_ASSERTIONS=1 ;; -esac -SHARED_LIBS="ON" - -# Build LLVM libraries for dynamically linking. Default is to build LLVM with statically linked libraries -BUILD_LLVM_DYLIB="OFF" - -FLANG_NEW=0 -CHK_FLANG="" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -ASSERT_LLVM_VERSION_MAJOR="" -ASSERT_LLVM_VERSION_MINOR="" - -SKIP_LIT_TESTS=0 -BUILD_MANPAGES="ON" -LLVM_INSTALL_UTILS="ON" -STATIC_FLAG= - -SANITIZER_AMDGPU=1 - -if [ -d "$WORK_ROOT/ROCR-Runtime/runtime/hsa-runtime/inc/" ]; then - HSA_INC_PATH="$WORK_ROOT/ROCR-Runtime/runtime/hsa-runtime/inc/" -else - HSA_INC_PATH="$WORK_ROOT/ROCR-Runtime/src/inc" -fi -COMGR_INC_PATH="$COMGR_ROOT/include" - -#parse the arguments -VALID_STR=`getopt -o hcV:v:draAswlo:BPNM --long help,clean,assert_llvm_ver_major:,assert_llvm_ver_minor:,debug,release,address_sanitizer,no_address_sanitizer,static,build_llvm_static,wheel,build,package,skip_lit_tests,skip_man_pages,skip_utils,compiler_rt_debug,compiler_rt_release,outdir: -- "$@"` -eval set -- "$VALID_STR" - -set_dwarf_version(){ - # In SLES and RHEL splitting debuginfo is getting failed(dwarf-5 unhandled) when compiler is set to clang. - # By default -gdwarf-5 is used for the compression of debug symbols - # So setting -gdwarf-4 - # SWDEV-462774: In RHEL/SLES with dwarf-4 enabled, seeing ASAN llvm build getting killed due to high memory usage. - # So adding -gsplit-dwarf which splits the debug information into separate files to reduce memory usage during linking. - case "$DISTRO_ID" in - (sles*|rhel*) - SET_DWARF_VERSION_4="-gdwarf-4 -gsplit-dwarf" - ;; - (*) - SET_DWARF_VERSION_4="" - ;; - esac - export CFLAGS="$CFLAGS $SET_DWARF_VERSION_4 " - export CXXFLAGS="$CXXFLAGS $SET_DWARF_VERSION_4 " - export ASMFLAGS="$ASMFLAGS $SET_DWARF_VERSION_4 " -} - -while true ; -do - #echo "processing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-V | --assert_llvm_ver_major) - ASSERT_LLVM_VERSION_MAJOR=$2 ; shift 2 ;; - (-v | --assert_llvm_ver_minor) - ASSERT_LLVM_VERSION_MINOR=$2 ; shift 2 ;; - (-d | --debug) - BUILD_TYPE="Debug" ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_dwarf_version - SANITIZER_AMDGPU=1 ; shift ;; - (-A | --no_address_sanitizer) - SANITIZER_AMDGPU=0 ; - unset HSA_INC_PATH ; - unset COMGR_INC_PATH ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; - STATIC_FLAG="-DBUILD_SHARED_LIBS=$SHARED_LIBS" ; shift ;; - (-l | --build_llvm_static) - BUILD_LLVM_DYLIB="OFF"; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-B | --build) - TARGET="build"; shift ;; - (-P | --package) - TARGET="package"; shift ;; - (-N | --skip_lit_tests) - SKIP_LIT_TESTS=1; shift ;; - (-M | --skip_man_pages) - BUILD_MANPAGES="OFF"; shift ;; - (--skip_utils) - LLVM_INSTALL_UTILS="OFF"; shift ;; - (--compiler_rt_debug) - COMPILER_RT_DEBUG="ON"; shift ;; - (--compiler_rt_release) - COMPILER_RT_DEBUG="OFF"; shift ;; - --) shift; break;; # end delimiter - (*) - echo " This should not happen : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -LLVM_PROJECTS="clang;lld;clang-tools-extra" -ENABLE_RUNTIMES="compiler-rt;libunwind" -BOOTSTRAPPING_BUILD_LIBCXX=0 -BUILD_AMDCLANG="ON" -# build libcxx to support the amdclang binary -ENABLE_RUNTIMES="$ENABLE_RUNTIMES;libcxx;libcxxabi" -BOOTSTRAPPING_BUILD_LIBCXX=1 - -clean_lightning() { - # Delete cmake output directory - rm -rf "$BUILD_PATH" - rm -rf "$DEB_PATH" - rm -rf "$RPM_PATH" -} - -# Collect LLVM/Clang git information for clang --version output. -# Include repo name, branch name and gitdate. -setup_llvm_info() { - # Allow this function to fail repo and git commands, but not crash the build. - set +e - mkdir -p "$LLVM_ROOT_LCL" - pushd "$LLVM_ROOT_LCL" - # Initialize local variable. Does not include - # LLVM_COMMIT_GITDATE and LLVM_REPO_INFO. - local LLVM_REMOTE_NAME - local LLVM_URL_NAME - local LLVM_BRANCH_NAME - local LLVM_URL_BRANCH - - # Release Build: set url to external repo. - # Internal Build: set url to actual url. - if [[ "${JOB_NAME}" == *rel* ]]; then - LLVM_URL_NAME="https://github.com/RadeonOpenCompute/llvm-project" - # Release branch follows convention roc-X.Y.x according to CI. - LLVM_BRANCH_NAME="roc-${ROCM_VERSION}" - LLVM_URL_BRANCH="${LLVM_URL_NAME} ${LLVM_BRANCH_NAME}" - else - LLVM_REMOTE_NAME=$(git remote) - LLVM_URL_NAME=$(git config --get remote."${LLVM_REMOTE_NAME}".url) - # Parse the manifest to obtain upstream branch. - LLVM_BRANCH_NAME=$(repo manifest | sed -n 's/.*path="external\/llvm-project".* upstream="\([^"]*\)".*/\1/p' ) - LLVM_URL_BRANCH="${LLVM_URL_NAME} ${LLVM_BRANCH_NAME}" - fi - - # Obtain git date information based on UTC time. - # Format date as yyuuw - [last two digits of year][work week][day of week]. - # Use xargs to remove trailing newline character. - LLVM_COMMIT_GITDATE=$(git show -s --format=@%ct | xargs | date -f - --utc +%y%U%w) - # Organize into REPO BRANCH GITDATE - LLVM_REPO_INFO="${LLVM_URL_BRANCH} ${LLVM_COMMIT_GITDATE}" - - popd - set -e -} - -LLVM_VERSION_MAJOR="" -LLVM_VERSION_MINOR="" -LLVM_VERSION_PATCH="" -LLVM_VERSION_SUFFIX="" -get_llvm_version() { - local LLVM_VERSIONS=($(awk '/set\(LLVM_VERSION/ {print substr($2,1,length($2)-1)}' ${LLVM_ROOT_LCL}/../cmake/Modules/LLVMVersion.cmake)) - if [ ${#LLVM_VERSIONS[@]} -eq 0 ]; then - LLVM_VERSIONS=($(awk '/set\(LLVM_VERSION/ {print substr($2,1,length($2)-1)}' ${LLVM_ROOT_LCL}/CMakeLists.txt)) - fi - LLVM_VERSION_MAJOR=${LLVM_VERSIONS[0]} - LLVM_VERSION_MINOR=${LLVM_VERSIONS[1]} - LLVM_VERSION_PATCH=${LLVM_VERSIONS[2]} - LLVM_VERSION_SUFFIX=${LLVM_VERSIONS[3]} - - echo "Detected LLVM version from source: ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}" -} - -# Generate compiler config files with default ROCm settings -create_compiler_config_files() { - local llvm_bin_dir="${INSTALL_PATH}/bin" - local rocm_cfg="rocm.cfg" - - # rocm.cfg content - { - echo "-Wl,--enable-new-dtags" - echo "--rocm-path='/../../..'" - echo "-frtlib-add-rpath" - } > "${llvm_bin_dir}/$rocm_cfg" - - local compiler_commands=("clang" "clang++" "clang-cpp" "clang-${LLVM_VERSION_MAJOR}" "clang-cl" ) - for i in "${compiler_commands[@]}"; do - if [ -f "$llvm_bin_dir/$i" ]; then - local config_file="${llvm_bin_dir}/${i}.cfg" - echo "@${rocm_cfg}" > $config_file - fi - done - - if [ $FLANG_NEW -eq 1 ]; then - local flang_commands=("flang" "flang-new" "flang-classic") - for i in "${flang_commands[@]}"; do - local config_file="${llvm_bin_dir}/${i}.cfg" - echo "@${rocm_cfg}" > $config_file - done - fi -} - -# Function to check if a list contains an element -# return true if $1 is in $2... -contains(){ - - local target=$1 element - shift - for element ; do - [ "$target" = "$element" ] && return 0 - done - return 1 -} - -build_lightning() { - # Obtain LLVM build information - setup_llvm_info - - get_llvm_version - if [ -n "${ASSERT_LLVM_VERSION_MAJOR}" ]; then - echo "Assert LLVM major version: ${ASSERT_LLVM_VERSION_MAJOR}"; - if [ "${ASSERT_LLVM_VERSION_MAJOR}" != "${LLVM_VERSION_MAJOR}" ]; then - echo "LLVM major version assertion failed, expected ${ASSERT_LLVM_VERSION_MAJOR} but detected ${LLVM_VERSION_MAJOR}!" - exit 1; - fi - fi - if [ -n "${ASSERT_LLVM_VERSION_MINOR}" ]; then - echo "Assert LLVM minor version: ${ASSERT_LLVM_VERSION_MINOR}"; - if [ "${ASSERT_LLVM_VERSION_MINOR}" != "${LLVM_VERSION_MINOR}" ]; then - echo "LLVM minor version assertion failed, expected ${ASSERT_LLVM_VERSION_MINOR} but detected ${LLVM_VERSION_MINOR}!" - exit 1; - fi - fi - - # Upstream llvm option -DCLANG_DEFAULT_PIE_ON_LINUX changed to ON - # by default however, it breaks ROCM builds on SLES/CentOS distros - # so disabling it for now in lighting compiler builds. - # Todo : this should be removed to follow the upstream's default. - DISABLE_PIE=0 - - # Find out distro / RHEL build here to adjust Python version for building LLVM if needed. - case "$DISTRO_ID" in - (rhel*|centos*) - RHEL_BUILD=1 - ;; - (*) - RHEL_BUILD=0 - ;; - esac - - # Special handling for Debian 10 - # - gcc is too ancient and can't build LLVM, switch to clang-13 instead - # - zstd is severely out-of-date and can't support LLVM, disable it - case "$DISTRO_ID" in - (debian-10) - BUILD_COMPILER_LINKER_FLAGS=("-DCMAKE_C_COMPILER=/usr/bin/clang-13" "-DCMAKE_CXX_COMPILER=/usr/bin/clang++-13" "-DLLVM_USE_LINKER=lld") - LLVM_COMPRESSION_FLAGS=("-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_ZSTD=OFF") - ;; - (*) - BUILD_COMPILER_LINKER_FLAGS=() - LLVM_COMPRESSION_FLAGS=("-DLLVM_ENABLE_ZLIB=ON") - ;; - esac - - # Upstream moved to requiring Python 3.8 as the minimum. - # Point CMake to that explicit location and adjust LD_LIBRARY_PATH. - PYTHON_VERSION_WORKAROUND='' - # TODO: Workshop the condition before landing, only to show - # what needs to be done for the Python issue. - echo "build_lightning DISTRO_ID: ${DISTRO_ID}" - if [[ "$DISTRO_ID" == "rhel-8"* || "$DISTRO_NAME" == "sles" || "$DISTRO_ID" == "debian-10" ]]; then - EXTRA_PYTHON_PATH=/opt/Python-3.8.13 - PYTHON_VERSION_WORKAROUND="-DPython3_EXECUTABLE=${EXTRA_PYTHON_PATH}/bin/python3.8" - # For the python interpreter we need to export LD_LIBRARY_PATH. - # XXX: This is only needed during CMake and ninja check-* targets, maybe we can limit scope further? - export LD_LIBRARY_PATH=${EXTRA_PYTHON_PATH}/lib:$LD_LIBRARY_PATH - fi - - # Start CMake Build - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - - #Extra llvm cmake parameter can be passed from an environment variable EXTRA_LLVM_CMAKE_PARAMS - #For example: - # export EXTRA_LLVM_CMAKE_PARAMS='-DLLVM_LIT_ARGS="-sv -j8" -DP2=1' - #Alternatively, this variable can be prefixed to this script: - # EXTRA_LLVM_CMAKE_PARAMS='-DLLVM_LIT_ARGS="-sv -j8" -DP2=1' build_lightning.sh - eval EXTRA_LLVM_CMAKE_PARAMS_ARRAY=($EXTRA_LLVM_CMAKE_PARAMS) - - if [ ! -e Makefile ]; then - echo "Building LLVM CMake environment" - LLVM_PROJECTS="$LLVM_PROJECTS;mlir" - if [ -e "$LLVM_ROOT_LCL/../flang/EnableFlangBuild" ]; then - FLANG_NEW=1 - LLVM_PROJECTS="$LLVM_PROJECTS;flang" - else - echo "NOT building project flang" - fi - set -x - cmake $(rocm_cmake_params) ${GEN_NINJA} \ - ${STATIC_FLAG} \ - ${PYTHON_VERSION_WORKAROUND} \ - -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" \ - -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" \ - -DLLVM_ENABLE_PROJECTS="$LLVM_PROJECTS" \ - -DLLVM_ENABLE_RUNTIMES="$ENABLE_RUNTIMES" \ - -DLIBCXX_ENABLE_SHARED=OFF \ - -DLIBCXX_ENABLE_STATIC=ON \ - -DLIBCXX_INSTALL_LIBRARY=OFF \ - -DLIBCXX_INSTALL_HEADERS=OFF \ - -DLIBCXXABI_ENABLE_SHARED=OFF \ - -DLIBCXXABI_ENABLE_STATIC=ON \ - -DLIBCXXABI_INSTALL_STATIC_LIBRARY=OFF \ - -DLLVM_BUILD_DOCS="$BUILD_MANPAGES" \ - -DLLVM_ENABLE_SPHINX="$BUILD_MANPAGES" \ - -DSPHINX_WARNINGS_AS_ERRORS=OFF \ - -DSPHINX_OUTPUT_MAN="$BUILD_MANPAGES" \ - -DLLVM_ENABLE_ASSERTIONS="$ENABLE_ASSERTIONS" \ - -DLLVM_ENABLE_Z3_SOLVER=OFF \ - -DLLVM_ENABLE_ZLIB=ON \ - -DLLVM_AMDGPU_ALLOW_NPI_TARGETS=ON \ - -DCLANG_REPOSITORY_STRING="$LLVM_REPO_INFO" \ - -DCLANG_DEFAULT_PIE_ON_LINUX="$DISABLE_PIE" \ - -DCLANG_DEFAULT_LINKER=lld \ - -DCLANG_DEFAULT_RTLIB=compiler-rt \ - -DCLANG_DEFAULT_UNWINDLIB=libgcc \ - -DCLANG_ENABLE_AMDCLANG="$BUILD_AMDCLANG" \ - -DSANITIZER_AMDGPU="$SANITIZER_AMDGPU" \ - -DPACKAGE_VENDOR="AMD" \ - -DSANITIZER_HSA_INCLUDE_PATH="$HSA_INC_PATH" \ - -DSANITIZER_COMGR_INCLUDE_PATH="$COMGR_INC_PATH" \ - -DLLVM_BUILD_LLVM_DYLIB="$BUILD_LLVM_DYLIB" \ - -DLLVM_LINK_LLVM_DYLIB="$BUILD_LLVM_DYLIB" \ - -DLLVM_ENABLE_LIBCXX="$BUILD_LLVM_DYLIB" \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE\ - -DCMAKE_SKIP_INSTALL_RPATH=TRUE\ - -DCMAKE_EXE_LINKER_FLAGS=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LLVM_EXE_RPATH \ - -DCMAKE_SHARED_LINKER_FLAGS=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LLVM_LIB_RPATH \ - -DROCM_LLVM_BACKWARD_COMPAT_LINK="$ROCM_INSTALL_PATH/llvm" \ - -DROCM_LLVM_BACKWARD_COMPAT_LINK_TARGET="./lib/llvm" \ - -DCLANG_LINK_FLANG_LEGACY=ON \ - -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath \ - -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=ON \ - -DCMAKE_CXX_STANDARD=17 \ - -DFLANG_INCLUDE_DOCS=OFF \ - -DLLVM_INSTALL_UTILS="$LLVM_INSTALL_UTILS" \ - -DCOMPILER_RT_DEBUG="$COMPILER_RT_DEBUG" \ - "${BUILD_COMPILER_LINKER_FLAGS[@]}" \ - "${LLVM_COMPRESSION_FLAGS[@]}" \ - "${EXTRA_LLVM_CMAKE_PARAMS_ARRAY[@]}" \ - "$LLVM_ROOT_LCL" - set +x - echo "CMake complete" - fi - - echo "Building LLVM" - - if [ $BOOTSTRAPPING_BUILD_LIBCXX -eq 1 ]; then - # The following is to do a bootstrap build of libc++ to support - # amdclang, which needs the C++17 std::filesystem library - # build clang first - cmake --build . -- $MAKEOPTS clang lld compiler-rt - # build libc++ and libcxxabi using the just-built clang - cmake --build . -- $MAKEOPTS runtimes cxx - fi - - # Remove these 12 lines - echo "Workaround for race condition" - # find make targets like clang_rt.asan-dynamic-ARCH-version-list - # and prebuild them. ARCH will include x86_64 but might also - # include i386, depending on the build environment. - # TODO figure out why ubuntu 18 builds the i386, but sles, centos - # and ubuntu 20 do not. If we can stop ubuntu 18 then it might - # give us some speed. - #for prebuild in $(make help | sed -n '/-version-list/s/^... //p') ; do - # make $MAKEOPTS $prebuild - #done - echo "End Workaround for race condition" - cmake --build . -- $MAKEOPTS - # FIXME: check-all would be better, but some tests require sys calls that - # are not allowed in the CI dockers and so fail. Switch to check-all - # when possible. - # FIXME: disable testing on sles; a test is failing for unknown reasons - # and breaking the sles build; keep it enabled everywhere else - # FIXME: disable check-clang on rhel; python 3.8 issue - # and breaking the rhel build; keep it enabled everywhere else - if [ $SKIP_LIT_TESTS -eq 0 ]; then - if [ $FLANG_NEW -eq 1 ]; then - CHK_FLANG="check-flang" - fi - if [ $RHEL_BUILD -eq 1 ]; then - cmake --build . -- $MAKEOPTS check-lld check-mlir - elif [ "$DISTRO_NAME" != "sles" ]; then - cmake --build . -- $MAKEOPTS check-llvm check-clang check-lld check-mlir $CHK_FLANG - fi - fi - cmake --build . -- $MAKEOPTS clang-tidy - cmake --build . -- $MAKEOPTS install - - popd -} - -package_lightning_dynamic(){ - - # do common stuff here: - if [ "$BUILD_TYPE" == "Debug" ]; then - return - fi - - # Echos ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX} - get_llvm_version - # We require the LLVM major, minor and patch. Scrub the LLVM_VERSION_SUFFIX. - local llvmParsedVersion="${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}" - local packageName="rocm-llvm" - local packageSummary="ROCm compiler" - local packageSummaryLong="ROCm compiler based on LLVM $llvmParsedVersion" - local installPath="$ROCM_INSTALL_PATH/lib/llvm/" - - # setup for rocm-llvm-core package - if [ "$BUILD_LLVM_DYLIB" == "ON" ] ; then - local packageNameCore="rocm-llvm-core" - local packageSummaryCore="ROCm core compiler dylibs" - local packageSummaryLongCore="ROCm compiler based on LLVM $llvmParsedVersion" - fi - - local packageArch="amd64" - local packageVersion="${llvmParsedVersion}.${LLVM_COMMIT_GITDATE}" - local packageMaintainer="ROCm Compiler Support " - local distBin="$INSTALL_PATH/bin" - local distInc="$INSTALL_PATH/include" - local distLib="$INSTALL_PATH/lib" - local distMan="$INSTALL_PATH/share/man" - local licenseDir="$ROCM_INSTALL_PATH/share/doc/$packageName" - local licenseDirCore="$ROCM_INSTALL_PATH/share/doc/$packageNameCore" - local packageDir="$BUILD_PATH/package" - local backwardsCompatibleSymlink="$ROCM_INSTALL_PATH/llvm" - - # Debian specific - local packageDeb="$packageDir/deb" - local controlFile="$packageDeb/DEBIAN/control" - local postinstFile="$packageDeb/DEBIAN/postinst" - local prermFile="$packageDeb/DEBIAN/prerm" - local specFile="$packageDir/$packageName.spec" - local debDependencies="python3, libc6, libstdc++6|libstdc++8, libstdc++-5-dev|libstdc++-7-dev|libstdc++-11-dev, libgcc-5-dev|libgcc-7-dev|libgcc-11-dev, rocm-core" - local debRecommends="gcc, g++, gcc-multilib, g++-multilib, rocm-device-libs" - - # RPM specific - local packageRpm="$packageDir/rpm" - local packageRpmCore="$packageDir/rpm" - local specFile="$packageDir/$packageName.spec" - local specFileCore="$packageDir/$packageNameCore.spec" - local rpmRequires="rocm-core" - if [ "$BUILD_LLVM_DYLIB" == "ON" ] ; then - rpmRequires+=", rocm-llvm-core" - fi - local rpmRequiresCore="rocm-core" - local rpmRecommends="gcc, gcc-c++, devtoolset-7-gcc-c++, rocm-device-libs" - - # Cleanup previous packages - rm -rf "$packageDir" - echo "rm -rf $packageDir" - rm -rf "$DEB_PATH" - - local amd_compiler_commands=("amdclang" "amdclang++" "amdclang-cl" "amdclang-cpp" "amdflang" "amdflang-new" "amdflang-legacy" "amdflang-classic" "amdlld" "offload-arch") - local amd_man_pages=("amdclang.1.gz" "amdclang++.1.gz" "flang.1.gz" "amdflang.1.gz") - local man_pages=("bugpoint.1" "FileCheck.1" "llvm-ar.1" "llvm-cxxmap.1" "llvm-extract.1" "llvm-lipo.1" "llvm-otool.1" "llvm-readobj.1" "llvm-symbolizer.1" "tblgen.1" - "clang.1" "lit.1" "llvm-as.1" "llvm-diff.1" "llvm-ifs.1" "llvm-locstats.1" "llvm-pdbutil.1" "llvm-remarkutil.1" "llvm-tblgen.1" "clang-tblgen.1" - "llc.1" "llvm-bcanalyzer.1" "llvm-dis.1" "llvm-install-name-tool.1" "llvm-mca.1" "llvm-profdata.1" "llvm-size.1" "llvm-tli-checker.1" "diagtool.1" - "lldb-tblgen.1" "llvm-config.1" "llvm-dwarfdump.1" "llvm-lib.1" "llvm-nm.1" "llvm-profgen.1" "llvm-stress.1" "mlir-tblgen.1" "dsymutil.1" "lli.1" - "llvm-cov.1" "llvm-dwarfutil.1" "llvm-libtool-darwin.1" "llvm-objcopy.1" "llvm-ranlib.1" "llvm-strings.1" "opt.1" "extraclangtools.1" "llvm-addr2line.1" - "llvm-cxxfilt.1" "llvm-exegesis.1" "llvm-link.1" "llvm-objdump.1" "llvm-readelf.1" "llvm-strip.1") - - # Only build deb in Ubuntu environment - if [ "$PACKAGEEXT" = "deb" ]; then - # Debian packaging - - mkdir -p "$packageDeb/$installPath" - mkdir -p "$(dirname $controlFile)" - mkdir -p "$DEB_PATH" - mkdir -p "$packageDeb/$licenseDir" - - # build the rocm-llvm-core package first: - # we only need some .so files, and we're doing a MV so that they're not picked up in the next (rocm-llvm) package. - if [ "$BUILD_LLVM_DYLIB" == "ON" ] ; then - - mkdir -p "$packageDeb/$licenseDirCore" - - # Copy the LICENSE file to rocm-core - cp -r "$LLVM_ROOT_LCL/LICENSE.TXT" "$packageDeb/$licenseDirCore" - - cp -P "$distLib/libLLVM"*"so"* "$packageDeb/$installPath/" - cp -P "$distLib/libFortran"*"so"* "$packageDeb/$installPath/" - cp -P "$distLib/libclang"*"so"* "$packageDeb/$installPath/" - - echo "Package: $packageNameCore" > $controlFile - echo "Architecture: $packageArch" >> $controlFile - echo "Section: devel" >> $controlFile - echo "Priority: optional" >> $controlFile - echo "Maintainer: $packageMaintainer" >> $controlFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Release: ${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Depends: $debDependencies" >> $controlFile - echo "Recommends: $debRecommends" >> $controlFile - echo "Description: $packageSummaryCore" >> $controlFile - echo " $packageSummaryLongCore" >> $controlFile - - fakeroot dpkg-deb -Zgzip --build $packageDeb \ - "${DEB_PATH}/${packageNameCore}_${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}_${packageArch}.deb" - - # clean up, get ready for rocm-llvm - rm -rf "$controlFile" - rm -rf "$packageDeb/$licenseDirCore" - - #remove the LLVM/Clang dylibs we already packaged in rocm-llvm-core - rm -f "$packageDeb/$installPath/libLLVM"*"so"* - rm -f "$packageDeb/$installPath/libFortran"*"so"* - rm -f "$packageDeb/$installPath/libclang"*"so"* - - mkdir -p "$(dirname $controlFile)" - - # clean up dylibs we already packaged: - rm -rf "$packageDeb/$installPath/*" - - # add this rocm-llvm-core package as a dependency for rocm-llvm - debDependencies="${debDependencies}, ${packageNameCore}" - fi # end of building rocm-llvm-core package - - # now build rocm-llvm: - # Install license file in rocm-llvm package . - cp -r "$LLVM_ROOT_LCL/LICENSE.TXT" "$packageDeb/$licenseDir" - cp -r "$distBin" "$packageDeb/$installPath/bin" - cp -r "$distInc" "$packageDeb/$installPath/include" - cp -r "$distLib" "$packageDeb/$installPath/lib" - if [ "$BUILD_MANPAGES" == "ON" ]; then - # zip the generated man pages before installing them in the package - for i in "${man_pages[@]}"; do - gzip -f "$distMan/man1/$i" - done - # Create symbolic links for amd man pages - if [ -f "$distMan/man1/clang.1.gz" ]; then - for i in "${amd_man_pages[@]}"; do - ln -sf "clang.1.gz" "$distMan/man1/$i" - done - fi - fi - cp -r "$distMan" "$packageDeb/$installPath/share" - - touch "$postinstFile" "$prermFile" - echo "mkdir -p \"$ROCM_INSTALL_PATH/bin\"" >> $postinstFile - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$packageDeb/$installPath/bin/$i" ]; then - echo "ln -s \"../lib/llvm/bin/$i\" \"$ROCM_INSTALL_PATH/bin/$i\"" >> $postinstFile - echo "rm -f \"$ROCM_INSTALL_PATH/bin/$i\"" >> $prermFile - fi - done - echo "rmdir --ignore-fail-on-non-empty \"$ROCM_INSTALL_PATH/bin\"" >> $prermFile - chmod 0555 "$postinstFile" "$prermFile" - cp -P "$backwardsCompatibleSymlink" "$packageDeb/$ROCM_INSTALL_PATH" - - echo "Package: $packageName" > $controlFile - echo "Architecture: $packageArch" >> $controlFile - echo "Section: devel" >> $controlFile - echo "Priority: optional" >> $controlFile - echo "Maintainer: $packageMaintainer" >> $controlFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Release: ${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Depends: $debDependencies" >> $controlFile - echo "Recommends: $debRecommends" >> $controlFile - echo "Description: $packageSummary" >> $controlFile - echo " $packageSummaryLong" >> $controlFile - - fakeroot dpkg-deb -Zgzip --build $packageDeb \ - "${DEB_PATH}/${packageName}_${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}_${packageArch}.deb" - fi - - # Only build RPM in CentOS or SLES or RHEL or Mariner environment - if [ "$PACKAGEEXT" = "rpm" ]; then - # RPM packaging - mkdir -p "$(dirname $specFile)" - rm -rf "$RPM_PATH" - mkdir -p "$RPM_PATH" - - # set up for rocm-llvm-core package - if [ "$BUILD_LLVM_DYLIB" == "ON" ] ; then - echo "Name: $packageNameCore" > $specFileCore - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}" >> $specFileCore - echo "Release: ${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}%{?dist}" >> $specFileCore - echo "Summary: $packageSummaryCore" >> $specFileCore - echo "Group: System Environment/Libraries" >> $specFileCore - echo "License: ASL 2.0 with exceptions" >> $specFileCore - echo "Requires: $rpmRequiresCore" >> $specFileCore - - echo "%description" >> $specFileCore - echo "$packageSummaryLongCore" >> $specFileCore - - echo "%prep" >> $specFileCore - echo "%setup -T -D -c -n $packageNameCore" >> $specFileCore - - echo "%install" >> $specFileCore - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFileCore - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/lib" >> $specFileCore - echo "mkdir -p \$RPM_BUILD_ROOT/$licenseDirCore" >> $specFileCore - - echo "cp -R $LLVM_ROOT_LCL/LICENSE.TXT \$RPM_BUILD_ROOT/$licenseDirCore" >> $specFileCore - - echo "cp -RP $distLib/libLLVM*so* \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFileCore - echo "cp -RP $distLib/libFortran*so* \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFileCore - echo "cp -RP $distLib/libclang*so* \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFileCore - - echo "%clean" >> $specFileCore - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFileCore - echo "%files " >> $specFileCore - echo "%defattr(-,root,root,-)" >> $specFileCore - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by rocm-llvm-core package - echo "$ROCM_INSTALL_PATH" >> $specFileCore - - echo "%post" >> $specFileCore - echo "%preun" >> $specFileCore - echo "%postun" >> $specFileCore - - echo "rpmbuild --define _topdir $packageRpmCore -ba $specFileCore" - rpmbuild --define "_topdir $packageRpmCore" -ba $specFileCore - - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH - fi # end of building rocm-lllvm-core package - - # setup for rocm-llvm package - echo "Name: $packageName" > $specFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}" >> $specFile - echo "Release: ${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}%{?dist}" >> $specFile - echo "Summary: $packageSummary" >> $specFile - echo "Group: System Environment/Libraries" >> $specFile - echo "License: ASL 2.0 with exceptions" >> $specFile - echo "Requires: $rpmRequires" >> $specFile - # The following is commented as Centos 7 has a version of rpm - # that does not understand it. When we no longer support Centos 7 - # then we should have a correct recommends line. - #echo "Recommends: $rpmRecommends" >> $specFile - - echo "%description" >> $specFile - echo "$packageSummaryLong" >> $specFile - - echo "%prep" >> $specFile - echo "%setup -T -D -c -n $packageName" >> $specFile - - echo "%install" >> $specFile - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/bin" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/include" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/lib" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/share/man" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - - echo "cp -R $LLVM_ROOT_LCL/LICENSE.TXT \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - echo "cp -P $backwardsCompatibleSymlink \$RPM_BUILD_ROOT/$ROCM_INSTALL_PATH" >> $specFile - echo "cp -R $distBin \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "cp -R $distInc \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "cp -R $distLib \$RPM_BUILD_ROOT/$installPath" >> $specFile - if [ "$BUILD_MANPAGES" == "ON" ]; then - # zip the generated man pages before installing them in the package - for i in "${man_pages[@]}"; do - echo "gzip -f $distMan/man1/$i" >> $specFile - done - # Create symbolic links for amd man pages - if [ -f "$distMan/man1/clang.1.gz" ]; then - for i in "${amd_man_pages[@]}"; do - echo "ln -sf clang.1.gz \"$distMan/man1/$i\"" >> $specFile - done - fi - fi - echo "cp -R $distMan \$RPM_BUILD_ROOT/$installPath/share" >> $specFile - - echo "%clean" >> $specFile - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "%files " >> $specFile - if [ "$BUILD_LLVM_DYLIB" == "ON" ] ; then - echo "%exclude $installPath/lib/libLLVM*so*" >> $specFile - echo "%exclude $installPath/lib/libFortran*so*" >> $specFile - echo "%exclude $installPath/lib/libclang*so*" >> $specFile - fi - - echo "%defattr(-,root,root,-)" >> $specFile - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by rocm-llvm package - echo "$ROCM_INSTALL_PATH" >> $specFile - - echo "%post" >> $specFile - echo "mkdir -p \"$ROCM_INSTALL_PATH/bin\"" >> $specFile - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$distBin/$i" ]; then - echo "ln -sf ../lib/llvm/bin/$i \"$ROCM_INSTALL_PATH/bin/$i\"" >> $specFile - fi - done - - echo "%preun" >> $specFile - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$distBin/$i" ]; then - echo "rm -f \"$ROCM_INSTALL_PATH/bin/$i\"" >> $specFile - fi - done - echo "rmdir --ignore-fail-on-non-empty \"$ROCM_INSTALL_PATH/bin\"" >> $specFile - echo "%postun" >> $specFile - - rpmbuild --define "_topdir $packageRpm" -ba $specFile - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH - fi -} - -package_lightning_static() { - - # do common stuff here: - if [ "$BUILD_TYPE" == "Debug" ]; then - return - fi - - # Echo the LLVM version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX} - get_llvm_version - # We require the LLVM major, minor and patch. Scrub the LLVM_VERSION_SUFFIX. - local llvmParsedVersion="${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}" - - # setup for rocm-llvm package - local packageName="rocm-llvm" - local packageSummary="ROCm core compiler" - local packageSummaryLong="ROCm core compiler based on LLVM $llvmParsedVersion" - # setup for rocm-llvm-dev package - if [ "$PACKAGEEXT" = "deb" ]; then - local packageNameExtra="rocm-llvm-dev" - else - local packageNameExtra="rocm-llvm-devel" - fi - local packageSummaryExtra="ROCm compiler dev tools" - local packageSummaryLongExtra="ROCm compiler dev tools and documentation, based on LLVM $llvmParsedVersion" - local installPath="$ROCM_INSTALL_PATH/lib/llvm/" - - local packageArch="amd64" - local packageVersion="${llvmParsedVersion}.${LLVM_COMMIT_GITDATE}" - local packageMaintainer="ROCm Compiler Support " - local distBin="$INSTALL_PATH/bin" - local distInc="$INSTALL_PATH/include" - local distLib="$INSTALL_PATH/lib" - local distMan="$INSTALL_PATH/share/man" - local licenseDir="$ROCM_INSTALL_PATH/share/doc/$packageName" - local packageDir="$BUILD_PATH/package" - local backwardsCompatibleSymlink="$ROCM_INSTALL_PATH/llvm" - - # Debian specific - local packageDeb="$packageDir/deb" - local controlFile="$packageDeb/DEBIAN/control" - local postinstFile="$packageDeb/DEBIAN/postinst" - local prermFile="$packageDeb/DEBIAN/prerm" - local specFile="$packageDir/$packageName.spec" - local debDependencies="python3, libc6, libstdc++6|libstdc++8, libstdc++-5-dev|libstdc++-7-dev|libstdc++-11-dev, libgcc-5-dev|libgcc-7-dev|libgcc-11-dev, rocm-core" - local debRecommends="gcc, g++, gcc-multilib, g++-multilib, rocm-device-libs" - - # RPM specific - local packageRpm="$packageDir/rpm" - local packageRpmExtra="$packageDir/rpm" - local specFile="$packageDir/$packageName.spec" - local specFileExtra="$packageDir/$packageNameExtra.spec" - local rpmRequires="rocm-core" - local rpmRequiresExtra="rocm-core, $packageName" - #local rpmRecommends="gcc, gcc-c++, devtoolset-7-gcc-c++, rocm-device-libs" - local rpmRecommends="rocm-device-libs" - - # Cleanup previous packages - rm -rf "$packageDir" - echo "rm -rf $packageDir" - rm -rf "$DEB_PATH" - - local amd_compiler_commands=("amdclang" "amdclang++" "amdclang-cl" "amdclang-cpp" "amdflang" "amdflang-new" "amdflang-legacy" "amdflang-classic" "amdlld" "offload-arch") - local amd_man_pages=("amdclang.1.gz" "amdclang++.1.gz" "flang.1.gz" "amdflang.1.gz") - local core_bin=("amd-llvm-spirv" "amdgpu-arch" "amdgpu-offload-arch" "amdlld" "amdllvm" "clang" "clang++" "clang-${LLVM_VERSION_MAJOR}" "clang-cl" - "clang-cpp" "clang-build-select-link" "clang-offload-bundler" "clang-offload-packager" "clang-offload-wrapper" "clang-linker-wrapper" "clang-nvlink-wrapper" "flang" "flang-new" "flang-legacy" "flang-classic" "llvm-symbolizer" - "ld64.lld" "ld.lld" "llc" "lld" "lld-link" "llvm-ar" "llvm-bitcode-strip" "llvm-dwarfdump" "llvm-install-name-tool" - "llvm-link" "llvm-mc" "llvm-objcopy" "llvm-objdump" "llvm-otool" "llvm-ranlib" "llvm-readelf" "llvm-readobj" "llvm-strip" - "nvidia-arch" "nvptx-arch" "offload-arch" "opt" "wasm-ld" "amdclang" "amdclang++" "amdclang-${LLVM_VERSION_MAJOR}" "amdclang-cl" - "amdclang-cpp" "amdflang" "amdflang-new" "amdflang-legacy" "amdflang-classic" - "clang++.cfg" "clang-${LLVM_VERSION_MAJOR}.cfg" "clang-cl.cfg" "clang-cpp.cfg" "clang.cfg" "rocm.cfg" - "flang.cfg" "flang-new.cfg" "flang-classic.cfg" ) - local core_lib=("libclang-cpp.so.${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX}" "libclang-cpp.so" "libclang.so" - "libclang-cpp.so.${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX}" - "libclang.so.${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX}" - "libclang.so.${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}" - "libFortranSemantics.a" "libFortranLower.a" "libFortranParser.a" "libFortranCommon.a" - "libFortranRuntime.a" "libFortranFloat128Math.a" "libFortranDecimal.a" "libFortranEvaluate.a") - local core_man_pages=("llvm-otool.1" "llvm-readobj.1" "clang.1" "lit.1" "llc.1" "llvm-ar.1" "llvm-dwarfdump.1" "llvm-objcopy.1" "opt.1" - "llvm-link.1" "llvm-mc.1" "llvm-objdump.1" "llvm-ranlib.1" "llvm-readelf.1" "llvm-strip.1") - local dev_man_pages=("bugpoint.1" "FileCheck.1" "llvm-cxxmap.1" "llvm-extract.1" "llvm-lipo.1" "llvm-symbolizer.1" - "tblgen.1" "llvm-as.1" "llvm-diff.1" "llvm-ifs.1" "llvm-locstats.1" "llvm-pdbutil.1" "llvm-remarkutil.1" - "llvm-tblgen.1" "clang-tblgen.1" "llvm-bcanalyzer.1" "llvm-dis.1" "llvm-install-name-tool.1" "llvm-mca.1" - "llvm-profdata.1" "llvm-size.1" "llvm-tli-checker.1" "diagtool.1" "lldb-tblgen.1" "llvm-config.1" "llvm-lib.1" - "llvm-nm.1" "llvm-opt-report.1" "llvm-profgen.1" "llvm-reduce.1" "llvm-stress.1" "mlir-tblgen.1" "dsymutil.1" - "lli.1" "llvm-cov.1" "llvm-dwarfutil.1" "llvm-libtool-darwin.1" "llvm-strings.1" - "extraclangtools.1" "llvm-addr2line.1" "llvm-cxxfilt.1" "llvm-exegesis.1" "scan-build.1") - - # Only build deb in Ubuntu environment - if [ "$PACKAGEEXT" = "deb" ]; then - # Debian packaging - - mkdir -p "$packageDeb/$installPath" - mkdir "${controlFile%/*}" - mkdir -p "$DEB_PATH" - mkdir -p "$packageDeb/$licenseDir" - - # Build the static rocm-llvm package first: - # We're doing a MV so that they're not picked up in the next (rocm-dev) package. - - # Install license file in rocm-llvm package. - cp -r "$LLVM_ROOT_LCL/LICENSE.TXT" "$packageDeb/$licenseDir" - - # Copy the core binaries - mkdir -p "$packageDeb/$installPath/bin" - for i in "${core_bin[@]}"; do - if [ -f "$distBin/$i" ]; then - cp -d "$distBin"/$i "$packageDeb/$installPath/bin/" - fi - done - # FIXME: At this point flang is pointing to flang-classic, which does - # not exist yet (created later), and code above does not copy it - # because it check if it exists first. Blindly copy flang for now. - # Permanent fix will be merged into openmp-extras by moving symlink - # creation there. - if [ -h $distBin/flang ]; then - cp -d "$distBin/flang" "$packageDeb/$installPath/bin/" - fi - - # Copy the core libraries - # TODO: Only copy llvm/lib/clang/X.0.0/include and llvm/lib/clang/X.0.0/lib/linux - mkdir -p "$packageDeb/$installPath/lib/clang" - cp -r "$distLib/clang/" "$packageDeb/$installPath/lib/" - - if [ $FLANG_NEW -eq 1 ]; then - # flang-new mod files - mkdir -p "$packageDeb/$installPath/include/flang" - cp -r "$distInc/flang/" "$packageDeb/$installPath/include/" - fi - - for i in "${core_lib[@]}"; do - if [ -f "$distLib/$i" ]; then - cp -dr "$distLib"/$i "$packageDeb/$installPath/lib" - fi - done - - # Copy core specific man pages - if [ "$BUILD_MANPAGES" == "ON" ]; then - mkdir -p "$packageDeb/$installPath/share/man1" - # zip the generated man pages before installing them in the package - for i in "${core_man_pages[@]}"; do - if [ -f "$distMan/man1/$i" ]; then - gzip -f "$distMan/man1/$i" - cp -d "$distMan/man1/${i}.gz" "$packageDeb/$installPath/share/man1/" - fi - done - # Create symbolic links for amd man pages - if [ -f "$distMan/man1/clang.1.gz" ]; then - for i in "${amd_man_pages[@]}"; do - ln -sf "clang.1.gz" "$distMan/man1/$i" - cp -d "$distMan/man1/${i}" "$packageDeb/$installPath/share/man1/" - done - fi - fi - - touch "$postinstFile" "$prermFile" - echo "mkdir -p \"$ROCM_INSTALL_PATH/bin\"" >> $postinstFile - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$packageDeb/$installPath/bin/$i" ]; then - echo "ln -s \"../lib/llvm/bin/$i\" \"$ROCM_INSTALL_PATH/bin/$i\"" >> $postinstFile - echo "rm -f \"$ROCM_INSTALL_PATH/bin/$i\"" >> $prermFile - fi - done - echo "rmdir --ignore-fail-on-non-empty \"$ROCM_INSTALL_PATH/bin\"" >> $prermFile - chmod 0555 "$postinstFile" "$prermFile" - if [ -h $backwardsCompatibleSymlink ]; then - cp -P "$backwardsCompatibleSymlink" "$packageDeb/$ROCM_INSTALL_PATH" - fi - - { - echo "Package: $packageName" - echo "Architecture: $packageArch" - echo "Section: devel" - echo "Priority: optional" - echo "Maintainer: $packageMaintainer" - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" - echo "Release: ${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" - echo "Depends: $debDependencies" - echo "Recommends: $debRecommends" - echo "Description: $packageSummary" - echo " $packageSummaryLong" - } >> "$controlFile" - - fakeroot dpkg-deb -Zgzip --build $packageDeb \ - "${DEB_PATH}/${packageName}_${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}_${packageArch}.deb" - - # clean up, get ready for rocm-llvm-dev - rm -rf "$controlFile" - rm -rf "$packageDeb" - - mkdir -p "$packageDeb/$installPath" - mkdir "${controlFile%/*}" - mkdir -p "$DEB_PATH" - - # now build rocm-llvm-dev: - mkdir -p "$packageDeb/$installPath/bin" - # Only copy binaries not packaged in core - for i in "$distBin"/*; do - bin=$(basename "$i") - contains "$bin" "${core_bin[@]}" "${amd_compiler_commands[@]}" && continue - cp -d "$i" "$packageDeb/$installPath/bin/" - done - - # Only copy libraries not packaged in core - for i in "$distLib"/*; do - lib=$(basename "$i") - contains "$lib" "${core_lib[@]}" && continue - cp -dr "$i" "$packageDeb/$installPath/lib/" - done - # Remove dirs already packaged in rocm-llvm-core - rm -rf "$packageDeb/$installPath/lib/clang" - - cp -r "$distInc" "$packageDeb/$installPath/include" - - if [ $FLANG_NEW -eq 1 ]; then - rm -rf "$packageDeb/$installPath/include/flang" - fi - - if [ "$BUILD_MANPAGES" == "ON" ]; then - mkdir -p "$packageDeb/$installPath/share/man1" - # zip the generated man pages before installing them in the package - for i in "${dev_man_pages[@]}"; do - if [ -f "$distMan/man1/$i" ]; then - gzip -f "$distMan/man1/$i" - cp -d "$distMan/man1/${i}.gz" "$packageDeb/$installPath/share/man1/" - fi - done - fi - - # add this rocm-llvm package as a dependency for rocm-llvm-dev - debDependencies="${debDependencies}, ${packageName}" - - echo "Package: $packageNameExtra" > $controlFile - echo "Architecture: $packageArch" >> $controlFile - echo "Section: devel" >> $controlFile - echo "Priority: optional" >> $controlFile - echo "Maintainer: $packageMaintainer" >> $controlFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Release: ${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" >> $controlFile - echo "Depends: $debDependencies" >> $controlFile - echo "Recommends: $debRecommends" >> $controlFile - echo "Description: $packageSummaryExtra" >> $controlFile - echo " $packageSummaryLongExtra" >> $controlFile - - fakeroot dpkg-deb -Zgzip --build $packageDeb \ - "${DEB_PATH}/${packageNameExtra}_${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}_${packageArch}.deb" - fi - - # Only build RPM in CentOS or SLES or RHEL or Mariner environment - if [ "$PACKAGEEXT" = "rpm" ]; then - # RPM packaging - - mkdir -p "$(dirname $specFile)" - rm -rf "$RPM_PATH" - mkdir -p "$RPM_PATH" - - # set up for rocm-llvm package - echo "Name: $packageName" >> $specFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}" >> $specFile - echo "Release: ${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}%{?dist}" >> $specFile - echo "Summary: $packageSummary" >> $specFile - echo "Group: System Environment/Libraries" >> $specFile - echo "License: ASL 2.0 with exceptions" >> $specFile - echo "Prefix: $ROCM_INSTALL_PATH" >> $specFile - echo "Requires: $rpmRequires" >> $specFile - if [[ "$DISTRO_ID" != "centos"* ]]; then - echo "Recommends: $rpmRecommends" >> $specFile - fi - echo "%description" >> $specFile - echo "$packageSummaryLong" >> $specFile - - echo "%prep" >> $specFile - echo "%setup -T -D -c -n $packageName" >> $specFile - - echo "%install" >> $specFile - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/bin" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - - # Install the license file to rocm-llvm - echo "cp -R $LLVM_ROOT_LCL/LICENSE.TXT \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - if [ -h $backwardsCompatibleSymlink ]; then - echo "cp -P $backwardsCompatibleSymlink \$RPM_BUILD_ROOT/$ROCM_INSTALL_PATH" >> $specFile - fi - - # Copy the core binaries - for i in "${core_bin[@]}"; do - if [ -f "$distBin/$i" ]; then - echo "cp -d \"$distBin\"/$i \$RPM_BUILD_ROOT/$installPath/bin/" >> $specFile - fi - done - - # FIXME: At this point flang is pointing to flang-classic, which does - # not exist yet (created later), and code above does not copy it - # because it check if it exists first. Blindly copy flang for now. - # Permanent fix will be merged into openmp-extras by moving symlink - # creation there. - if [ -h $distBin/flang ]; then - echo "cp -d \"$distBin/flang\" \$RPM_BUILD_ROOT/$installPath/bin/" >> $specFile - fi - - # Copy the config files - echo "cp -d \"$distBin\"/*.cfg \$RPM_BUILD_ROOT/$installPath/bin/" >> $specFile - - # Copy the core libraries - # TODO: Only copy llvm/lib/clang/X.0.0/include and llvm/lib/clang/X.0.0/lib/linux - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/lib/clang" >> $specFile - echo "cp -R \"$distLib/clang/\" \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFile - - if [ $FLANG_NEW -eq 1 ]; then - # flang-new mod files - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/include/flang" >> $specFile - echo "cp -R \"$distInc/flang/\" \$RPM_BUILD_ROOT/$installPath/include/" >> $specFile - fi - - for i in "${core_lib[@]}"; do - if [ -f "$distLib/$i" ]; then - echo "cp -dr \"$distLib\"/$i \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFile - fi - done - - # Copy core specific man pages - if [ "$BUILD_MANPAGES" == "ON" ]; then - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/share/man/man1" >> $specFile - # zip the generated man pages before installing them in the package - for i in "${core_man_pages[@]}"; do - if [ -f "$distMan/man1/$i" ]; then - echo "gzip -f ${distMan}/man1/${i}" >> $specFile - echo "cp -d ${distMan}/man1/${i}.gz \$RPM_BUILD_ROOT/$installPath/share/man/man1/" >> $specFile - fi - done - # Create symbolic links for amd man pages - for i in "${amd_man_pages[@]}"; do - echo "ln -sf clang.1.gz ${distMan}/man1/${i}" >> $specFile - echo "cp -d ${distMan}/man1/${i} \$RPM_BUILD_ROOT/$installPath/share/man/man1/" >> $specFile - done - fi - - echo "%clean" >> $specFile - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFile - echo "%files " >> $specFile - echo "%defattr(-,root,root,-)" >> $specFile - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by rocm-llvm-core package - { - echo "$ROCM_INSTALL_PATH" - - echo "%post" - echo "mkdir -p \"\$RPM_INSTALL_PREFIX0/bin\"" - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$distBin/$i" ]; then - echo "ln -sf ../lib/llvm/bin/$i \"\$RPM_INSTALL_PREFIX0/bin/$i\"" - fi - done - - echo "%preun" - for i in "${amd_compiler_commands[@]}"; do - if [ -f "$distBin/$i" ]; then - echo "rm -f \"\$RPM_INSTALL_PREFIX0/bin/$i\"" - fi - done - echo "rmdir --ignore-fail-on-non-empty \"\$RPM_INSTALL_PREFIX0/bin\"" - - echo "%postun" - } >> "$specFile" - - echo "rpmbuild --define _topdir $packageRpm -ba $specFile" - rpmbuild --define "_topdir $packageRpm" -ba $specFile - - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH - - # setup for rocm-llvm-dev package - echo "Name: $packageNameExtra" > $specFileExtra - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}" >> $specFileExtra - echo "Release: ${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}%{?dist}" >> $specFileExtra - echo "Summary: $packageSummaryExtra" >> $specFileExtra - echo "Group: System Environment/Libraries" >> $specFileExtra - echo "License: ASL 2.0 with exceptions" >> $specFileExtra - echo "Prefix: $ROCM_INSTALL_PATH" >> $specFileExtra - echo "Requires: $rpmRequiresExtra" >> $specFileExtra - # The following is commented as Centos 7 has a version of rpm - # that does not understand it. When we no longer support Centos 7 - # then we should have a correct recommends line. - #echo "Recommends: $rpmRecommends" >> $specFileExtra - - echo "%description" >> $specFileExtra - echo "$packageSummaryLongExtra" >> $specFileExtra - - echo "%prep" >> $specFileExtra - echo "%setup -T -D -c -n $packageNameExtra" >> $specFileExtra - - echo "%install" >> $specFileExtra - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFileExtra - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/bin" >> $specFileExtra - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/include" >> $specFileExtra - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/lib" >> $specFileExtra - - echo "cp -P $backwardsCompatibleSymlink \$RPM_BUILD_ROOT/$ROCM_INSTALL_PATH" >> $specFileExtra - - # Only copy binaries not packaged in core - for i in "$distBin"/*; do - bin=$(basename "$i") - contains "$bin" "${core_bin[@]}" "${amd_compiler_commands[@]}" && continue - echo "cp -d \"$i\" \$RPM_BUILD_ROOT/$installPath/bin/" >> $specFileExtra - done - # Only copy libraries not packaged in core - for i in "$distLib"/*; do - lib=$(basename "$i") - contains "$lib" "${core_lib[@]}" && continue - echo "cp -dr \"$i\" \$RPM_BUILD_ROOT/$installPath/lib/" >> $specFileExtra - done - - echo "cp -R $distInc \$RPM_BUILD_ROOT/$installPath" >> $specFileExtra - # Remove dirs already packaged in rocm-llvm-core - echo "rm -rf \$RPM_BUILD_ROOT/$installPath/lib/clang" >> $specFileExtra - - if [ $FLANG_NEW -eq 1 ]; then - # Remove flang mods packaged in rocm-llvm-core - echo "rm -rf \$RPM_BUILD_ROOT/$installPath/include/flang" >> $specFileExtra - fi - - if [ "$BUILD_MANPAGES" == "ON" ]; then - echo "mkdir -p \$RPM_BUILD_ROOT/$installPath/share/man/man1" >> $specFileExtra - # zip the generated man pages before installing them in the package - for i in "${dev_man_pages[@]}"; do - if [ -f "$distMan/man1/$i" ]; then - echo "gzip -f $distMan/man1/$i" >> $specFileExtra - echo "cp -d \"$distMan/man1/${i}.gz\" \$RPM_BUILD_ROOT/$installPath/share/man/man1/" >> $specFileExtra - fi - done - fi - - echo "%clean" >> $specFileExtra - echo "rm -rf \$RPM_BUILD_ROOT/$installPath" >> $specFileExtra - echo "%files " >> $specFileExtra - - echo "%defattr(-,root,root,-)" >> $specFileExtra - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by rocm-llvm package - echo "$ROCM_INSTALL_PATH" >> $specFileExtra - - echo "%post" >> $specFileExtra - echo "%preun" >> $specFileExtra - echo "%postun" >> $specFileExtra - - rpmbuild --define "_topdir $packageRpmExtra" -ba $specFileExtra - mv $packageRpmExtra/RPMS/x86_64/*.rpm $RPM_PATH - fi -} - -package_docs() { - - # do common stuff here: - if [ "$BUILD_TYPE" == "Debug" ]; then - return - fi - - if [ "$BUILD_MANPAGES" == "OFF" ]; then - return - fi - - # Echo the LLVM version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX} - get_llvm_version - # We require the LLVM major, minor and patch. Scrub the LLVM_VERSION_SUFFIX. - local llvmParsedVersion="${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}" - - local packageName="rocm-llvm-docs" - local packageSummary="ROCm LLVM compiler documentation" - local packageSummaryLong="Documenation for LLVM $llvmParsedVersion" - - local packageArch="amd64" - local packageVersion="${llvmParsedVersion}.${LLVM_COMMIT_GITDATE}" - local packageMaintainer="ROCm Compiler Support " - local distDoc="$INSTALL_PATH/share/doc/LLVM" - - local licenseDir="$ROCM_INSTALL_PATH/share/doc/$packageName" - local packageDir="$BUILD_PATH/package" - - # Debian specific - local packageDeb="$packageDir/deb" - local controlFile="$packageDeb/DEBIAN/control" - local debDependencies="rocm-core" - - # RPM specific - local packageRpm="$packageDir/rpm" - local specFile="$packageDir/$packageName.spec" - local rpmRequires="rocm-core" - - # Cleanup previous packages - rm -rf "$packageDir" - echo "rm -rf $packageDir" - - # Only build deb in Ubuntu environment - if [ "$PACKAGEEXT" = "deb" ]; then - - # Debian packaging - mkdir -p "$packageDeb/$licenseDir" - mkdir "${controlFile%/*}" - - # Install license file in rocm-llvm-docs package. - cp -r "$LLVM_ROOT_LCL/LICENSE.TXT" "$packageDeb/$licenseDir" - - # Copy the docs - cp -r "$distDoc" "$packageDeb/$licenseDir" - - { - echo "Package: $packageName" - echo "Architecture: $packageArch" - echo "Section: devel" - echo "Priority: optional" - echo "Maintainer: $packageMaintainer" - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" - echo "Release: ${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}" - echo "Depends: $debDependencies" - echo "Recommends: $debRecommends" - echo "Description: $packageSummary" - echo " $packageSummaryLong" - } >> "$controlFile" - - fakeroot dpkg-deb -Zgzip --build $packageDeb \ - "${DEB_PATH}/${packageName}_${packageVersion}.${ROCM_LIBPATCH_VERSION}-${JOB_DESIGNATOR}${BUILD_ID}~${DISTRO_RELEASE}_${packageArch}.deb" - fi - - # Only build RPM in CentOS or SLES or RHEL or Mariner environment - if [ "$PACKAGEEXT" = "rpm" ]; then - - # RPM packaging - mkdir -p "$(dirname $specFile)" - mkdir -p "$RPM_PATH" - - # set up for rocm-llvm-docs package - echo "Name: $packageName" > $specFile - echo "Version: ${packageVersion}.${ROCM_LIBPATCH_VERSION}" >> $specFile - echo "Release: ${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}%{?dist}" >> $specFile - echo "Summary: $packageSummary" >> $specFile - echo "Group: System Environment/Libraries" >> $specFile - echo "License: ASL 2.0 with exceptions" >> $specFile - echo "Prefix: $ROCM_INSTALL_PATH" >> $specFile - echo "Requires: $rpmRequires" >> $specFile - - echo "%description" >> $specFile - echo "$packageSummaryLong" >> $specFile - - echo "%prep" >> $specFile - echo "%setup -T -D -c -n $packageName" >> $specFile - - echo "%install" >> $specFile - echo "mkdir -p \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - - # Install the license file to rocm-llvm-docs - echo "cp -R $LLVM_ROOT_LCL/LICENSE.TXT \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - - # Copy the docs - echo "cp -R \"$distDoc\" \$RPM_BUILD_ROOT/$licenseDir" >> $specFile - - echo "%clean" >> $specFile - echo "%files " >> $specFile - echo "%defattr(-,root,root,-)" >> $specFile - - echo "$ROCM_INSTALL_PATH" >> $specFile - - rpmbuild --define "_topdir $packageRpm" -ba $specFile - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH - - fi - -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -build() { - mkdir -p "${INSTALL_PATH}" - build_lightning - create_compiler_config_files -} - -case $TARGET in - (clean) clean_lightning ;; - (all) - time build - time package_lightning_static - time package_docs - build_wheel "$BUILD_PATH" "$PROJ_NAME" - ;; - (build) - build - ;; - (package) - package_lightning_static - package_docs - ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_miopen-deps.sh b/tools/rocm-build/build_miopen-deps.sh deleted file mode 100755 index fb3ef0de7..000000000 --- a/tools/rocm-build/build_miopen-deps.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src MIOpen - -build_miopen_mlir() { - echo "Building rocMLIR" - mlir_commit="$1" - if [ -z "$mlir_commit" ]; then - echo "rocMLIR entry was not found in requirements.txt" - return - fi - mkdir -p /var/tmp/rocMLIR && cd /var/tmp/rocMLIR - wget -nv "https://www.github.com/ROCmSoftwarePlatform/rocMLIR/archive/${mlir_commit}.tar.gz" - tar -xzf "${mlir_commit}.tar.gz" - cd "rocMLIR-${mlir_commit}" - mkdir build && cd build - cmake \ - -G Ninja \ - -DCMAKE_C_COMPILER="$(set_build_variables __CLANG__)" \ - -DCMAKE_CXX_COMPILER="$(set_build_variables __CLANG++__)" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="${ROCM_PATH};${HOME}/miopen-deps" \ - -DCMAKE_INSTALL_PREFIX="$ROCM_PATH" \ - -DBUILD_FAT_LIBROCKCOMPILER=1 \ - .. - cmake --build . -- librockCompiler -j${PROC} - cmake --build . -- install - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - - echo "Finished building rocMLIR" -} - -clean_miopen_mlir() { - echo "Cleaning rocMLIR" - rm -rf /var/tmp/rocMLIR -} - -build_miopen_deps() { - echo "Start build" - cd "$COMPONENT_SRC" - - # Commenting the rocMLIR & composable_kernel from requirements.txt - sed -i '/ROCm\/rocMLIR@\|ROCm\/composable_kernel@/s/^/#/' requirements.txt - # Extract MLIR commit from requirements.txt - MLIR_COMMIT="$(awk '/rocMLIR/ {split($1, s, "@"); print s[2]}' requirements.txt)" - - - pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz - PATH="${PATH}:${ROCM_PATH}:${HOME}/.local/bin" rbuild prepare -d "$HOME/miopen-deps" --cxx="$(set_build_variables __CLANG++__)" --cc "$(set_build_variables __CLANG__)" - build_miopen_mlir "$MLIR_COMMIT" - - show_build_cache_stats -} - -clean_miopen_deps() { - echo "Cleaning MIOpen-Deps build directory: ${BUILD_DIR}" - rm -rf "$BUILD_DIR" - clean_miopen_mlir - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_miopen_deps ;; - outdir) ;; - clean) clean_miopen_deps ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_miopen-hip.sh b/tools/rocm-build/build_miopen-hip.sh deleted file mode 100755 index 30c595dbc..000000000 --- a/tools/rocm-build/build_miopen-hip.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src MIOpen - -PACKAGE_DIR=${PACKAGE_DIR%\/*}/miopen-hip -DEB_PATH=$PACKAGE_DIR -RPM_PATH=$PACKAGE_DIR - -disable_debug_package_generation - -build_miopen_hip() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - git config --global --add safe.directory "$COMPONENT_SRC" - checkout_lfs - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - mkdir "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - -DMIOPEN_BACKEND=HIP \ - -DMIOPEN_OFFLINE_COMPILER_PATHS_V2=1 \ - -DCMAKE_CXX_COMPILER=$(set_build_variables __CLANG++__) \ - -DCMAKE_C_COMPILER=$(set_build_variables __CLANG__) \ - -DCMAKE_PREFIX_PATH="${ROCM_PATH};${ROCM_PATH}/hip;${HOME}/miopen-deps" \ - -DHIP_OC_COMPILER="${ROCM_PATH}/bin/clang-ocl" \ - -DMIOPEN_TEST_DISCRETE=OFF \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf $BUILD_DIR/_CPack_Packages/ && find $BUILD_DIR -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_miopen_hip() { - echo "Cleaning MIOpen-HIP build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -checkout_lfs() { - git lfs install --local --force - git lfs pull --exclude= -} - -stage2_command_args "$@" - -case $TARGET in - build) build_miopen_hip; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_miopen_hip ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_mivisionx.sh b/tools/rocm-build/build_mivisionx.sh deleted file mode 100755 index a8480759d..000000000 --- a/tools/rocm-build/build_mivisionx.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src MIVisionX -BUILD_DEV=ON - -build_mivisionx() { - - if [ "$DISTRO_ID" = "mariner-2.0" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ] ; then - echo "Not building mivisionx for ${DISTRO_ID}. Exiting..." - return 0 - fi - - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - CXX=$(set_build_variables __AMD_CLANG_++__) - mkdir -p $BUILD_DIR && cd $BUILD_DIR - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # Setting BUILD_DEV to OFF. This will prevent the installation of - # header files, other files in share,libexec folder. ASAN pkg doesn't need this - BUILD_DEV=OFF - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - - init_rocm_common_cmake_params - - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - -DROCM_PATH="$ROCM_PATH" \ - -DBUILD_DEV=$BUILD_DEV \ - -DCMAKE_INSTALL_LIBDIR=$(getInstallLibDir) \ - -DROCM_DEP_ROCMCORE=ON \ - -DROCAL_PYTHON=OFF \ - ${LAUNCHER_FLAGS} \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cpack -G ${PKGTYPE^^} - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_mivisionx() { - echo "Cleaning MIVisionX build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_mivisionx; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_mivisionx ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_omniperf.sh b/tools/rocm-build/build_omniperf.sh deleted file mode 100755 index 3539efff1..000000000 --- a/tools/rocm-build/build_omniperf.sh +++ /dev/null @@ -1,149 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -w, --wheel Creates python wheel package of omniperf. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="omniperf" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -# PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$API_NAME" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - -#parse the arguments -VALID_STR=$(getopt -o hcraso:p:w --long help,clean,release,static,address_sanitizer,outdir:,package:,wheel -- "$@") -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage ; exit 0;; - -c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - -r | --release) - BUILD_TYPE="Release" ; shift ;; - -a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - -s | --static) - SHARED_LIBS="OFF" ; shift ;; - -o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - -p | --package) - MAKETARGET="$2" ; shift 2 ;; - -w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - --) shift; break;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options "$CLEAN_OR_OUT" "$PKGTYPE" "$MAKETARGET" -if [ $RET_CONFLICT -ge 30 ]; then - print_vars "$API_NAME" "$TARGET" "$BUILD_TYPE" "$SHARED_LIBS" "$CLEAN_OR_OUT" "$PKGTYPE" "$MAKETARGET" - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME:?}" - rm -rf "$PACKAGE_LIB/${LIB_NAME:?}"* -} - -build() { - echo "Building $PROJ_NAME" - if [ "$DISTRO_ID" = centos-7 ]; then - echo "Skip make and uploading packages for Omniperf on Centos7 distro, due to python dependency" - exit 0 - fi - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" || exit - - echo "ROCm CMake Params: $(rocm_cmake_params)" - echo "ROCm Common CMake Params: $(rocm_common_cmake_params)" - - #install python deps - #python3 -m pip install -t ${BUILD_DIR}/python-libs -r ${OMNIPERF_ROOT}/requirements.txt - print_lib_type $SHARED_LIBS - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DCHECK_PYTHON_DEPS=NO \ - -DPYTHON_DEPS=${BUILD_DIR}/python-libs \ - -DMOD_INSTALL_PATH=${BUILD_DIR}/modulefiles \ - "$OMNIPERF_ROOT" - fi - make $MAKE_OPTS - make $MAKE_OPTS install - make $MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo "${PACKAGE_DEB}";; - ("rpm") - echo "${PACKAGE_RPM}";; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_omnitrace.sh b/tools/rocm-build/build_omnitrace.sh deleted file mode 100755 index 855e58c73..000000000 --- a/tools/rocm-build/build_omnitrace.sh +++ /dev/null @@ -1,243 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -w, --wheel Creates python wheel package of omnitrace. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="omnitrace" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -# PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$API_NAME" -# PACKAGE_PREFIX="$ROCM_INSTALL_PATH" -BUILD_TYPE="Debug" -MAKE_OPTS="-j 8" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" -ASAN=0 - -#parse the arguments -VALID_STR=$(getopt -o hcraso:p:w --long help,clean,release,address_sanitizer,static,outdir:,package:,wheel -- "$@") -eval set -- "$VALID_STR" - -while true; do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="RelWithDebInfo" - shift - ;; - -a | --address_sanitizer) - ack_and_ignore_asan - # set_asan_env_vars - # set_address_sanitizer_on - - ASAN=1 - shift - ;; - -s | --static) - SHARED_LIBS="OFF" - shift - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - # OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - -p | --package) - MAKETARGET="$2" - shift 2 - ;; - -w | --wheel) - WHEEL_PACKAGE=true - shift - ;; - --) - shift - break - ;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME:?}" - rm -rf "$PACKAGE_LIB/${LIB_NAME:?}"* -} - -build_omnitrace() { - echo "Building $PROJ_NAME" - if [ "$DISTRO_ID" = "mariner-2.0" ] || [ "$DISTRO_ID" = "ubuntu-24.04" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ]; then - echo "Skip make and uploading packages for Omnitrace on \"${DISTRO_ID}\" distro" - exit 0 - fi - - if [ $ASAN == 1 ]; then - echo "Skip make and uploading packages for Omnitrace on ASAN build" - exit 0 - fi - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - echo "Created build directory: $BUILD_DIR" - fi - - cd $OMNITRACE_ROOT || exit - - echo "Current submodule status" - git submodule status - echo "Cached (old) submodule status" - git submodule status --cached - cat .git/config - - echo "Updating submodules" - git submodule init - # copy the new URL to your local config - git submodule sync --recursive - # force update the submodule from the new URL - git submodule update --init --recursive --force - - echo "Updated submodule status" - git submodule status - cat .git/config - - echo "Build directory: $BUILD_DIR" - pushd "$BUILD_DIR" || exit - print_lib_type $SHARED_LIBS - - ELFUTIL_URL="https://compute-artifactory.amd.com/artifactory/rocm-generic-local/dev-tools/omnitrace/elfutils-0.188.tar.bz2" - BINUTIL_URL="https://compute-artifactory.amd.com/artifactory/rocm-generic-local/dev-tools/omnitrace/binutils-2.40.tar.gz" - - echo "ROCm CMake Params: $(rocm_cmake_params)" - echo "ROCm Common CMake Params: $(rocm_common_cmake_params)" - echo "ELFUTIL_URL=$ELFUTIL_URL, BINUTIL_URL=$BINUTIL_URL" - - if [ $ASAN == 1 ]; then - echo "Address Sanitizer path" - - # Commenting out the below cmake command as it is not working as expected - # LD_LIBRARY_PATH=$ROCM_INSTALL_PATH/lib/asan:$LD_LIBRARY_PATH - # cmake \ - # $(rocm_cmake_params) \ - # $(rocm_common_cmake_params) \ - # -DOMNITRACE_BUILD_{LIBUNWIND,DYNINST}=ON \ - # -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON \ - # -DAMDDeviceLibs_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/AMDDeviceLibs" \ - # -Dhip_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip" \ - # -Dhip-lang_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip-lang" \ - # -Damd_comgr_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/amd_comgr" \ - # -Dhsa-runtime64_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsa-runtime64" \ - # -Dhsakmt_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsakmt" \ - # -DROCM_PATH="${ROCM_INSTALL_PATH}/lib/asan" \ - # -Drocprofiler_ROOT_DIR="${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCMAKE_HIP_COMPILER_ROCM_ROOT="${ROCM_INSTALL_PATH}" \ - # -DCMAKE_PREFIX_PATH="${ROCM_INSTALL_PATH};${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCMAKE_LIBRARY_PATH="${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=OFF \ - # "$OMNITRACE_ROOT" - - else - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DOMNITRACE_BUILD_{LIBUNWIND,DYNINST}=ON \ - -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON \ - -DElfUtils_DOWNLOAD_URL="$ELFUTIL_URL" \ - -D{DYNINST,TIMEMORY}_BINUTILS_DOWNLOAD_URL="$BINUTIL_URL" \ - "$OMNITRACE_ROOT" - fi - - - popd || exit - - echo "Make Options: $MAKE_OPTS" - cmake --build "$BUILD_DIR" --target all -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target install -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target package -- $MAKE_OPTS - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo "${PACKAGE_DEB}" - ;; - "rpm") - echo "${PACKAGE_RPM}" - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - clean) clean ;; - build) build_omnitrace; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - outdir) print_output_directory ;; - *) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_opencl_cts.sh b/tools/rocm-build/build_opencl_cts.sh deleted file mode 100755 index 264b6f8a8..000000000 --- a/tools/rocm-build/build_opencl_cts.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -PROJ_NAME=opencl-cts -TARGET="build" -MAKEOPTS="$DASH_JAY" -BUILD_TYPE="Debug" -OPENCL_ICD_LOADER_BUILD_DIR="$(getBuildPath)/OpenCL-ICD-Loader" -OPENCL_CTS_BUILD_DIR="$(getBuildPath)/OpenCL-CTS" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -w, --wheel Creates python wheel package of opencl-cts. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo " -o, --outdir Print path of output directory containing packages" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - return 0 -} - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $TARGET $BUILD_TYPE $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_opencl_cts() { - echo "Cleaning $PROJ_NAME" - rm -rf "$OPENCL_CTS_BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/opencl-cts" -} - -build_opencl_cts() { - echo "Building $PROJ_NAME" - mkdir -p "$OPENCL_CTS_BUILD_DIR" - pushd "$OPENCL_CTS_BUILD_DIR" - if [ ! -e Makefile ]; then - cmake \ - -S "$OPENCL_CTS_ROOT" \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DCL_INCLUDE_DIR="$OPENCL_HEADERS_ROOT" \ - -DCL_LIB_DIR="$OPENCL_ICD_LOADER_BUILD_DIR" \ - -DOPENCL_LIBRARIES="-lOpenCL -lpthread" \ - -DGL_IS_SUPPORTED="ON" - fi - cmake --build . -- $MAKEOPTS - popd -} - -package_opencl_cts() { - echo "Packaging $PROJ_NAME" - pushd "$OPENCL_CTS_BUILD_DIR" - cmake --build . -- package - mkdir -p $PACKAGE_DEB - mkdir -p $PACKAGE_RPM - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -#parse the arguments -VALID_STR=`getopt -o hcraswlo:p: --long help,clean,release,static,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" -while true ; -do - case "$1" in - (-c | --clean ) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release ) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-h | --help ) - printUsage ; exit 0 ;; - (-a | --address_sanitizer) - ack_and_ignore_asan ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - (-s | --static) - echo "-s parameter accepted but ignored" ; shift ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac -done - -case $TARGET in - (clean) clean_opencl_cts ;; - (build) build_opencl_cts ; package_opencl_cts; build_wheel "$OPENCL_ICD_LOADER_BUILD_DIR" "$PROJ_NAME";; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_opencl_icd_loader.sh b/tools/rocm-build/build_opencl_icd_loader.sh deleted file mode 100755 index 2f80cf4ba..000000000 --- a/tools/rocm-build/build_opencl_icd_loader.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -PROJ_NAME="OpenCL-ICD-Loader" -TARGET="build" -MAKEOPTS="$DASH_JAY" -BUILD_TYPE="Debug" -OPENCL_ICD_LOADER_BUILD_DIR="$(getBuildPath ${PROJ_NAME})" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/${PROJ_NAME,,}" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/${PROJ_NAME,,}" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -w, --wheel Creates python wheel package of opencl-icd-loader. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo " -o, --outdir Print path of output directory containing packages" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - return 0 -} - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $TARGET $BUILD_TYPE $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_opencl_icd_loader() { - echo "Cleaning $PROJ_NAME" - rm -rf "$OPENCL_ICD_LOADER_BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/opencl-icd-loader" -} - -build_opencl_icd_loader() { - echo "Building $PROJ_NAME" - if [ ! -e "$OPENCL_ICD_LOADER_ROOT/CMakeLists.txt" ] - then - echo "No $OPENCL_ICD_LOADER_ROOT/CMakeLists.txt file, skipping opencl icd loader" >&2 - echo "No $OPENCL_ICD_LOADER_ROOT/CMakeLists.txt file, skipping opencl icd loader" - exit 0 # This is not an error - fi - - mkdir -p "$OPENCL_ICD_LOADER_BUILD_DIR" - pushd "$OPENCL_ICD_LOADER_BUILD_DIR" - if [ ! -e Makefile ]; then - cmake \ - -S "$OPENCL_ICD_LOADER_ROOT" \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DENABLE_OPENCL_LAYERS="OFF" \ - -DOPENCL_ICD_LOADER_HEADERS_DIR="$OPENCL_HEADERS_ROOT" - fi - cmake --build . -- $MAKEOPTS - echo "Installing opencl-icd-loader" - cmake --build . -- $MAKEOPTS install - popd -} - -package_opencl_icd_loader() { - echo "Packaging $PROJ_NAME" - pushd "$OPENCL_ICD_LOADER_BUILD_DIR" - cmake --build . -- package - mkdir -p $PACKAGE_DEB - mkdir -p $PACKAGE_RPM - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -#parse the arguments -VALID_STR=`getopt -o hcraswlo:p: --long help,clean,release,wheel,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" -while true ; -do - case "$1" in - (-c | --clean ) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release ) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-h | --help ) - printUsage ; exit 0 ;; - (-a | --address_sanitizer) - ack_and_ignore_asan ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - (-s | --static) - echo "-s parameter accepted but ignored" ; shift ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac -done - -case $TARGET in - (clean) - clean_opencl_icd_loader - ;; - (build) - build_opencl_icd_loader - package_opencl_icd_loader - build_wheel "$OPENCL_ICD_LOADER_BUILD_DIR" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_opencl_on_rocclr.sh b/tools/rocm-build/build_opencl_on_rocclr.sh deleted file mode 100755 index 5654e4667..000000000 --- a/tools/rocm-build/build_opencl_on_rocclr.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...] [make options]" - echo - echo "Options:" - echo " -h, --help Prints this help" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -w, --wheel Creates python wheel package of opencl. - It needs to be used along with -r option" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} -PROJ_NAME="opencl-on-rocclr" -MAKEOPTS="$DASH_JAY" -BUILD_PATH="$(getBuildPath $PROJ_NAME)" -TARGET="build" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -CORE_BUILD_DIR="$(getBuildPath hsa-core)" -ROCclr_BUILD_DIR="$(getBuildPath rocclr)" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcrawso: --long help,clean,release,static,wheel,address_sanitizer,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_opencl_on_rocclr() { - # Delete cmake output directory - rm -rf "$BUILD_PATH" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/bin/clinfo" - rm -rf "$PACKAGE_ROOT/lib/libOpenCL.so*" - rm -rf "$PACKAGE_ROOT/lib/libamdocl64.so" - rm -rf "$PACKAGE_ROOT/lib/libcltrace.so" -} - -build_opencl_on_rocclr() { - # TODO This if condition is a temporary workaround so that mainline builds dont error out - # until build migrated from opencl to clr repo - if [ -e "$CLR_ROOT/CMakeLists.txt" ]; then - # We are in a branch that has migrated to clr repo - _OCL_CMAKELIST_DIR="$CLR_ROOT" - _OCL_CMAKELIST_OPT="-DCLR_BUILD_HIP=OFF -DCLR_BUILD_OCL=ON" - elif [ ! -e "$OPENCL_ON_ROCclr_ROOT/CMakeLists.txt" ]; then - # We seem to have hit a branch in which both the old and the new repo don't exist - echo "No $OPENCL_ON_ROCclr_ROOT/CMakeLists.txt file, skipping opencl on rocclr" >&2 - echo "No $OPENCL_ON_ROCclr_ROOT/CMakeLists.txt file, skipping opencl on rocclr" - exit 0 # This is not an error - else - # We are in a branch that has not yet migrated to clr repo yet - _OCL_CMAKELIST_DIR="$OPENCL_ON_ROCclr_ROOT" - _OCL_CMAKELIST_OPT="" - fi - - echo "$_OCL_CMAKELIST_DIR" - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - - # FIXME: Remove -DROCclr_DIR/LIBROCclr_STATIC_DIR - if [ ! -e Makefile ]; then - echo "Building OpenCL-On-ROCclr CMake environment" - - cmake \ - $(rocm_cmake_params) \ - -DUSE_COMGR_LIBRARY=ON \ - $(rocm_common_cmake_params) \ - -DLINK_COMGR_STATIC="no" \ - -DBUILD_TESTS=ON \ - $_OCL_CMAKELIST_OPT \ - "$_OCL_CMAKELIST_DIR" - - echo "CMake complete" - fi - - echo "Building OpenCL-On-ROCclr" - cmake --build . -- $MAKEOPTS - - echo "Installing OpenCL-On-ROCclr" - cmake --build . -- $MAKEOPTS install - - popd -} - -package_opencl_on_rocclr() { - echo "Packaging OpenCL-On-ROCclr" - pushd "$BUILD_PATH" - cmake --build . -- package - mkdir -p $PACKAGE_DEB - mkdir -p $PACKAGE_RPM - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" *.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" *.rpm - popd -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_opencl_on_rocclr - ;; - (build) - build_opencl_on_rocclr - package_opencl_on_rocclr - build_wheel "$BUILD_PATH" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_openmp_extras.sh b/tools/rocm-build/build_openmp_extras.sh deleted file mode 100755 index 698fc2d77..000000000 --- a/tools/rocm-build/build_openmp_extras.sh +++ /dev/null @@ -1,852 +0,0 @@ -#!/bin/bash - -source ${BASH_SOURCE%/*}/compute_utils.sh - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -w, --wheel Creates python wheel package of openmp-extras. - It needs to be used along with -r option" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -s, --static Component/Build does not support static builds just accepting this param for configuring package deps" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} -PROJ_NAME="openmp-extras" -packageMajorVersion="18.63" -packageMinorVersion="0" -packageVersion="${packageMajorVersion}.${packageMinorVersion}.${ROCM_LIBPATCH_VERSION}" -BUILD_PATH="$(getBuildPath $PROJ_NAME)" -DEB_PATH="$(getDebPath $PROJ_NAME)" -RPM_PATH="$(getRpmPath $PROJ_NAME)" -TARGET="build" -MAKEOPTS="$DASH_JAY" -STATIC_PKG_DEPS="OFF" - -# Should only need to update this variable when moving -# to the new ROCM_INSTALL_PATH. -export INSTALL_PREFIX=${ROCM_INSTALL_PATH} - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,address_sanitizer,static,outdir,wheel:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - -c | --clean ) - TARGET="clean" ;; - -p | --package ) - TARGET="package" ;; - -r | --release ) - ;; - -a | --address_sanitizer ) - set_asan_env_vars - set_address_sanitizer_on - # The path will be appended to cmake prefix path for asan builds - # Required for finding cmake config files for asan builds - export ROCM_CMAKECONFIG_PATH="$INSTALL_PREFIX/lib/asan/cmake" - export VERBOSE=1 - # openmp debug build of ompd uses python build, which defaults to gcc - export LDSHARED="$INSTALL_PREFIX/lib/llvm/bin/clang -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2" - # SANITIZER is used in openmp-debug build scripts so that the asan C/CXX Flags are not overwritten - export SANITIZER=1 ;; - -o | --outdir ) - shift 1; PKGTYPE=$1 ; TARGET="outdir" ;; - -w | --wheel ) - WHEEL_PACKAGE=true ;; - -s | --static ) - export STATIC_PKG_DEPS="ON" ;; - -h | --help ) - printUsage ; exit 0 ;; - --) shift; break;; # end delimiter - *) - MAKEARG=$@ ; break ;; - esac - shift 1 -done - - -clean_openmp_extras() { - # Delete cmake output and install directory - rm -rf "$BUILD_PATH" - rm -rf "$INSTALL_PREFIX/openmp-extras" -} - -toStdoutStderr(){ - printf '%s\n' "$@" >&2 - printf '%s\n' "$@" -} - -clean_examples(){ - rm -f "$1"/*.sh - rm -f "$1"/fortran/*.sh - rm -f "$1"/openmp/*.sh -} - -build_openmp_extras() { - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - echo "Building openmp-extras" - echo BUILD_PATH: $BUILD_PATH - echo "INSTALL_PREFIX:$INSTALL_PREFIX" - export AOMP_STANDALONE_BUILD=0 - # FIXME: Check the build scripts to see if support for DEVEL package - # is on. This can be removed once the old packaging logic is gone. This - # may return a non-zero, so for now do not error out the script. - set +e - checkDevel=$(grep "ENABLE_DEVEL_PACKAGE=ON" $AOMP_REPOS/aomp/bin/build_openmp.sh) - set -e - if [ "$checkDevel" == "" ]; then - export AOMP=$INSTALL_PREFIX/lib/llvm - else - export DEVEL_PACKAGE="devel/" - export AOMP=$INSTALL_PREFIX/openmp-extras - fi - export BUILD_AOMP=$BUILD_PATH - - # EPSDB does not build hsa, we need to pick it up from ROCm install location. - if [ "$EPSDB" == "1" ]; then - export ROCM_DIR=$ROCM_INSTALL_PATH - else - export ROCM_DIR=$INSTALL_PREFIX - fi - - if [ -d "$ROCM_DIR" ]; then - echo "--------------------------" - echo "ROCM_DIR:" - echo "----------" - ls $ROCM_DIR - echo "--------------------------" - fi - if [ -d "$ROCM_DIR"/include ]; then - echo "ROCM_DIR/include:" - echo "----------" - ls $ROCM_DIR/include - echo "--------------------------" - fi - if [ -d "$ROCM_DIR"/include/hsa ]; then - echo "ROCM_DIR/include/hsa:" - echo "----------" - ls $ROCM_DIR/include/hsa - echo "--------------------------" - fi - - export AOMP_JENKINS_BUILD_LIST="extras openmp pgmath flang flang_runtime" - echo "BEGIN Build of openmp-extras" - "$AOMP_REPOS"/aomp/bin/build_aomp.sh $MAKEARG - - # Create symlinks for omp headers. Stage 2 components need these. - local llvm_ver=`$INSTALL_PREFIX/lib/llvm/bin/clang --print-resource-dir | sed 's^/llvm/lib/clang/^ ^' | awk '{print $2}'` - if [ ! -e $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp.h ] ; then - if [ ! -h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp.h ] ; then - ln -s ../../../../include/omp.h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp.h - fi - fi - if [ ! -e $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/ompt.h ] ; then - if [ ! -h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/ompt.h ] ; then - ln -s ../../../../include/ompt.h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/ompt.h - fi - fi - if [ ! -e $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp-tools.h ] ; then - if [ ! -h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp-tools.h ] ; then - ln -s ../../../../include/omp-tools.h $ROCM_INSTALL_PATH/lib/llvm/lib/clang/$llvm_ver/include/omp-tools.h - fi - fi - popd -} - -package_openmp_extras_deb() { - # Debian packaging - local packageName=$1 - local packageDeb="$packageDir/deb" - local packageArch="amd64" - local packageMaintainer="Openmp Extras Support " - local packageSummary="OpenMP Extras provides openmp and flang libraries." - local packageSummaryLong="openmp-extras $packageVersion is based on LLVM 17 and is used for offloading to Radeon GPUs." - local debDependencies="rocm-llvm, rocm-device-libs, rocm-core" - local debRecommends="gcc, g++" - local controlFile="$packageDeb/openmp-extras/DEBIAN/control" - - if [ "$packageName" == "openmp-extras-runtime" ]; then - packageType="runtime" - if [ "$STATIC_PKG_DEPS" == "OFF" ]; then - debDependencies="rocm-core, hsa-rocr" - else - echo "static package dependency configuration for runtime" ; - debDependencies="rocm-core, hsa-rocr-static-dev" - fi - else - local debProvides="openmp-extras" - local debConflicts="openmp-extras" - local debReplaces="openmp-extras" - packageType="devel" - if [ "$STATIC_PKG_DEPS" == "OFF" ]; then - debDependencies="$debDependencies, openmp-extras-runtime, hsa-rocr-dev" - else - echo "Enabled static package dependency configuration for dev" ; - debDependencies="$debDependencies, openmp-extras-runtime, hsa-rocr-static-dev" - fi - fi - # copyPath = /opt/rocm - # installPath = /opt/rocm/lib/llvm - # FIXME: openmp-extras/devel logic can be removed once the new packaging lands - # New packaging uses installed_files.txt the openmp-extras/devel - # directory will no longer exist. - if [ -f "$BUILD_PATH"/build/installed_files.txt ] && [ ! -d "$INSTALL_PREFIX"/openmp-extras/devel ]; then - if [ "$packageType" == "runtime" ]; then - # Cleanup previous packages - rm -rf "$packageDir" - rm -rf "$DEB_PATH" - mkdir -p "$DEB_PATH" - mkdir -p $packageDeb/openmp-extras - # Licensing - # Copy licenses into share/doc/openmp-extras - mkdir -p $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras - cp -r $AOMP_REPOS/aomp/LICENSE $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.apache2 - cp -r $AOMP_REPOS/aomp-extras/LICENSE $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.mit - cp -r $AOMP_REPOS/flang/LICENSE.txt $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.flang - else - rm -rf $packageDeb/openmp-extras/* - mkdir -p $packageDeb/openmp-extras$copyPath/bin - if [ -d "$installPath"/lib-debug/src ]; then - cp -r --parents "$installPath"/lib-debug/src $packageDeb/openmp-extras - else - cp -r --parents "$ompdSrcDir" $packageDeb/openmp-extras - fi - fi - else - # FIXME: Old packaging method, can delete once new packaging lands. - if [ "$packageType" == "runtime" ]; then - # Cleanup previous packages - rm -rf "$packageDir" - rm -rf "$DEB_PATH" - mkdir -p "$DEB_PATH" - mkdir -p $packageDeb/openmp-extras$installPath - mkdir -p $packageDeb/openmp-extras$installPath/lib/clang/$llvm_ver/include - # Licensing - # Copy licenses into share/doc/openmp-extras - mkdir -p $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras - cp -r $AOMP_REPOS/aomp/LICENSE $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.apache2 - cp -r $AOMP_REPOS/aomp-extras/LICENSE $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.mit - cp -r $AOMP_REPOS/flang/LICENSE.txt $packageDeb/openmp-extras$copyPath/share/doc/openmp-extras/LICENSE.flang - else - # Clean packageDeb for devel build - rm -rf $packageDeb/openmp-extras$installPath/* - rm -rf $packageDeb/openmp-extras/bin - rm -rf $packageDeb/openmp-extras$copyPath/share - echo mkdir -p $packageDeb/openmp-extras$copyPath/bin - mkdir -p $packageDeb/openmp-extras$copyPath/bin - mkdir -p $packageDeb/openmp-extras$installPath/lib/clang/$llvm_ver/include - fi - fi - - mkdir -p "$(dirname $controlFile)" - - # Copy openmp-extras files, bin will turn into llvm/bin - if [ -f "$BUILD_PATH"/build/installed_files.txt ] && [ ! -d "$INSTALL_PREFIX"/openmp-extras/devel ]; then - if [ "$packageType" == "runtime" ]; then - cat "$BUILD_PATH"/build/installed_files.txt | grep -P '\.so|\.a' | cut -d":" -f2 | cut -d" " -f2 | xargs -I {} cp -d --parents {} "$packageDeb"/openmp-extras - # libgomp and libiomp5 are not on the install_manifest.txt and need - # to be manually copied. Waiting on trunk patch to flow into amd-staging - # to ensure these symlinks are in the manifest. - cp -d --parents "$installPath/lib/libgomp.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib/libiomp5.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib-debug/libgomp.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib-debug/libiomp5.so" "$packageDeb"/openmp-extras - else - cat "$BUILD_PATH"/build/installed_files.txt | grep -Pv '\.so|\.a' | cut -d":" -f2 | cut -d" " -f2 | xargs -I {} cp -d --parents {} "$packageDeb"/openmp-extras - fi - else - # FIXME: Old packaging method, can delete once new packaging lands. - cp -r "$AOMP"/"$packageType"/* "$packageDeb"/openmp-extras"$installPath" - fi - - # Copy examples - if [ "$packageType" == "devel" ]; then - mkdir -p "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - echo cp -r "$AOMP_REPOS"/aomp/examples/fortran "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - cp -r "$AOMP_REPOS"/aomp/examples/fortran "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - cp -r "$AOMP_REPOS"/aomp/examples/openmp "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - cp -r "$AOMP_REPOS"/aomp/examples/tools "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - if [ -e "$AOMP_REPOS/aomp/examples/Makefile.help" ]; then - cp "$AOMP_REPOS"/aomp/examples/Makefile* "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - fi - clean_examples "$packageDeb"/openmp-extras"$copyPath"/share/openmp-extras/examples - fi - - if [ "$packageType" == "devel" ]; then - # Create symbolic links for openmp header files - ln -s ../../../../include/omp.h $packageDeb/openmp-extras$installPath/lib/clang/$llvm_ver/include/omp.h - ln -s ../../../../include/ompt.h $packageDeb/openmp-extras$installPath/lib/clang/$llvm_ver/include/ompt.h - ln -s ../../../../include/omp-tools.h $packageDeb/openmp-extras$installPath/lib/clang/$llvm_ver/include/omp-tools.h - # Only create symlinks if file exists - if [ ! -h "$packageDeb"/openmp-extras"$copyPath"/bin/aompcc ] && [ -e "$packageDeb"/openmp-extras"$installPath"/bin/aompcc ]; then - ln -s ../lib/llvm/bin/aompcc "$packageDeb"/openmp-extras"$copyPath"/bin/aompcc - fi - if [ -e "$packageDeb"/openmp-extras"$installPath"/bin/mymcpu ]; then - ln -s ../lib/llvm/bin/mymcpu "$packageDeb"/openmp-extras"$copyPath"/bin/mymcpu - fi - if [ -e "$packageDeb"/openmp-extras"$installPath"/bin/mygpu ]; then - ln -s ../lib/llvm/bin/mygpu "$packageDeb"/openmp-extras"$copyPath"/bin/mygpu - fi - fi - - # Inspect - ls -l "$packageDeb"/openmp-extras"$installPath" - if [ "$packageType" == "devel" ]; then - ls -l "$packageDeb"/openmp-extras"$installPath"/bin - ls -l "$packageDeb"/openmp-extras"$copyPath"/bin - fi - - # Create control file - { - echo "Package: $packageName" - echo "Architecture: $packageArch" - echo "Section: devel" - echo "Priority: optional" - echo "Maintainer: $packageMaintainer" - echo "Version: $packageVersion-${CPACK_DEBIAN_PACKAGE_RELEASE}" - echo "Depends: $debDependencies" - echo "Recommends: $debRecommends" - if [ "$packageType" == "devel" ]; then - echo "Provides: $debProvides" - echo "Conflicts: $debConflicts" - echo "Replaces: $debReplaces" - fi - echo "Description: $packageSummary" - echo " $packageSummaryLong" - } > $controlFile - fakeroot dpkg-deb -Zgzip --build $packageDeb/openmp-extras \ - "$DEB_PATH/${packageName}_${packageVersion}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${packageArch}.deb" -} - -# ASAN debian package -package_openmp_extras_asan_deb() { - # Debian packaging - local packageName=$1 - local packageDeb="$packageDir/deb" - local packageArch="amd64" - local packageMaintainer="Openmp Extras Support " - local packageSummary="AddressSanitizer OpenMP Extras provides instrumented openmp and flang libraries." - local packageSummaryLong="openmp-extras $packageVersion is based on LLVM 17 and is used for offloading to Radeon GPUs." - local debDependencies="hsa-rocr-asan, rocm-core-asan" - local debRecommends="gcc, g++" - local controlFile="$packageDeb/openmp-extras/DEBIAN/control" - local asanLibDir="runtime" - - rm -rf "$packageDir" - rm -rf "$DEB_PATH" - mkdir -p "$DEB_PATH" - # Licensing - # Copy licenses into share/doc/openmp-extras-asan - local licenseDir="$packageDeb/openmp-extras$copyPath/share/doc/openmp-extras-asan" - mkdir -p $licenseDir - cp -r $AOMP_REPOS/aomp/LICENSE $licenseDir/LICENSE.apache2 - cp -r $AOMP_REPOS/aomp-extras/LICENSE $licenseDir/LICENSE.mit - cp -r $AOMP_REPOS/flang/LICENSE.txt $licenseDir/LICENSE.flang - - mkdir -p "$(dirname $controlFile)" - if [ -f "$BUILD_PATH"/build/installed_files.txt ] && [ ! -d "$INSTALL_PREFIX"/openmp-extras ]; then - cat "$BUILD_PATH"/build/installed_files.txt | grep -P 'asan' | cut -d":" -f2 | cut -d" " -f2 | xargs -I {} cp -d --parents {} "$packageDeb"/openmp-extras - # libgomp and libiomp5 are not on the install_manifest.txt and need - # to be manually copied. Waiting on trunk patch to flow into amd-staging - # to ensure these symlinks are in the manifest. - cp -d --parents "$installPath/lib/asan/libgomp.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib/asan/libiomp5.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib-debug/asan/libgomp.so" "$packageDeb"/openmp-extras - cp -d --parents "$installPath/lib-debug/asan/libiomp5.so" "$packageDeb"/openmp-extras - # FIXME: Old packaging method, can delete once new packaging lands. - else - mkdir -p $packageDeb/openmp-extras$installPath/lib/asan - mkdir -p $packageDeb/openmp-extras$installPath/lib-debug/asan - # runtime folder have asan libraries. Copy to asan folder for packaging - cp -r "$AOMP"/lib/asan/* "$packageDeb"/openmp-extras"$installPath"/lib/asan/ - cp -r "$AOMP"/lib-debug/asan/* "$packageDeb"/openmp-extras"$installPath"/lib-debug/asan/ - cp -r "$AOMP"/"$asanLibDir"/lib/asan/* "$packageDeb"/openmp-extras"$installPath"/lib/asan/ - cp -r "$AOMP"/"$asanLibDir"/lib-debug/asan/* "$packageDeb"/openmp-extras"$installPath"/lib-debug/asan/ - cp -r "$AOMP"/devel/lib/asan/* "$packageDeb"/openmp-extras"$installPath"/lib/asan/ - cp -r "$AOMP"/devel/lib-debug/asan/* "$packageDeb"/openmp-extras"$installPath"/lib-debug/asan/ - fi - - # Create control file - { - echo "Package: $packageName" - echo "Architecture: $packageArch" - echo "Section: devel" - echo "Priority: optional" - echo "Maintainer: $packageMaintainer" - echo "Version: $packageVersion-${CPACK_DEBIAN_PACKAGE_RELEASE}" - echo "Depends: $debDependencies" - echo "Recommends: $debRecommends" - echo "Description: $packageSummary" - echo " $packageSummaryLong" - } > $controlFile - fakeroot dpkg-deb -Zgzip --build $packageDeb/openmp-extras \ - "$DEB_PATH/${packageName}_${packageVersion}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${packageArch}.deb" -} - - -package_openmp_extras_rpm() { - # RPM packaging - local packageName=$1 - local packageRpm="$packageDir/rpm" - local specFile="$packageDir/$packageName.spec" - local packageSummary="OpenMP Extras provides openmp and flang libraries." - local packageSummaryLong="openmp-extras $packageVersion is based on LLVM 17 and is used for offloading to Radeon GPUs." - local rpmRequires="rocm-llvm, rocm-device-libs, rocm-core" - if [ "$packageName" == "openmp-extras-runtime" ]; then - packageType="runtime" - if [ "$STATIC_PKG_DEPS" == "OFF" ]; then - rpmRequires="rocm-core, hsa-rocr" - else - rpmRequires="rocm-core, hsa-rocr-static-devel" - fi - else - local rpmProvides="openmp-extras" - local rpmObsoletes="openmp-extras" - packageType="devel" - if [ "$STATIC_PKG_DEPS" == "OFF" ]; then - rpmRequires="$rpmRequires, openmp-extras-runtime, hsa-rocr-devel" - else - rpmRequires="$rpmRequires, openmp-extras-runtime, hsa-rocr-static-devel" - fi - fi - - # Cleanup previous packages - if [ "$packageType" == "runtime" ]; then - rm -rf "$packageDir" - rm -rf "$RPM_PATH" - mkdir -p "$RPM_PATH" - fi - echo RPM_PATH: $RPM_PATH - echo mkdir -p $(dirname $specFile) - mkdir -p "$(dirname $specFile)" - - { - # FIXME: Remove all conditions for empty packageType when - # devel and runtime packaging changes land in mainline. - echo "%define is_runtime %( if [ $packageType == runtime ]; then echo "1" ; else echo "0"; fi )" - echo "%define is_devel %( if [ $packageType == devel ]; then echo "1" ; else echo "0"; fi )" - - echo "Name: $packageName" - echo "Version: $packageVersion" - echo "Release: ${CPACK_RPM_PACKAGE_RELEASE}%{?dist}" - echo "Summary: $packageSummary" - echo "Group: System Environment/Libraries" - echo "License: MIT and ASL 2.0 and ASL 2.0 with exceptions" - echo "Vendor: Advanced Micro Devices, Inc." - echo "Prefix: $INSTALL_PREFIX" - echo "Requires: $rpmRequires" - echo "%if %is_devel" - echo "Provides: $rpmProvides" - echo "Obsoletes: $rpmObsoletes" - echo "%endif" - echo "%define debug_package %{nil}" - # Redefining __os_install_post to remove stripping - echo "%define __os_install_post %{nil}" - echo "%description" - echo "$packageSummaryLong" - - echo "%prep" - echo "%setup -T -D -c -n $packageName" - echo "%build" - - echo "%install" - echo "if [ -f $BUILD_PATH/build/installed_files.txt ] && [ ! -d $INSTALL_PREFIX/openmp-extras/devel ]; then" - echo " %if %is_runtime" - echo " mkdir -p \$RPM_BUILD_ROOT/openmp-extras" - echo " %else" - echo " mkdir -p \$RPM_BUILD_ROOT$copyPath/bin" - echo " mkdir -p \$RPM_BUILD_ROOT$installPath/lib/clang/$llvm_ver/include" - echo " %endif" - # FIXME: Old packaging method, can delete once new packaging lands. - echo "else" - echo " %if %is_runtime" - echo " mkdir -p \$RPM_BUILD_ROOT$installPath" - echo " %else" - echo " rm -rf \$RPM_BUILD_ROOT/openmp-extras$installPath/*" - echo " echo mkdir -p \$RPM_BUILD_ROOT$copyPath/bin" - echo " mkdir -p \$RPM_BUILD_ROOT$copyPath/bin" - echo " mkdir -p \$RPM_BUILD_ROOT$installPath/lib/clang/$llvm_ver/include" - echo " %endif" - echo "fi" - - # Copy openmp-extras files, bin will turn into llvm/bin - echo "if [ -f $BUILD_PATH/build/installed_files.txt ] && [ ! -d $INSTALL_PREFIX/openmp-extras/devel ]; then" - echo " %if %is_runtime" - echo " cat $BUILD_PATH/build/installed_files.txt | grep -P '\.so|\.a' | cut -d':' -f2 | cut -d' ' -f2 | xargs -I {} cp -d --parents {} \$RPM_BUILD_ROOT" - # libgomp and libiomp5 are not on the install_manifest.txt and need - # to be manually copied. Waiting on trunk patch to flow into amd-staging - # to ensure these symlinks are in the manifest. - echo " cp -d --parents "$installPath/lib/libgomp.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib/libiomp5.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib-debug/libgomp.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib-debug/libiomp5.so" \$RPM_BUILD_ROOT" - echo " %endif" - echo "%if %is_devel" - echo " cat "$BUILD_PATH"/build/installed_files.txt | grep -Pv '\.so|\.a' | cut -d':' -f2 | cut -d' ' -f2 | xargs -I {} cp -d --parents {} \$RPM_BUILD_ROOT" - echo "%endif" - # FIXME: Old packaging method, can delete once new packaging lands. - echo "else" - echo " cp -r $AOMP/$packageType/* \$RPM_BUILD_ROOT$installPath" - # Devel does not have examples in the llvm dir - echo " %if %is_devel" - echo " rm -rf \$RPM_BUILD_ROOT$installPath/share" - echo " %endif" - echo "fi" - - # Create symbolic links from /opt/rocm/bin to /opt/rocm/lib/llvm/bin utilities - #echo "ls \$RPM_BUILD_ROOT$installPath" - echo "%if %is_devel" - echo " if [ ! -h \$RPM_BUILD_ROOT$copyPath/bin/aompcc ] && [ -e \$RPM_BUILD_ROOT$installPath/bin/aompcc ]; then" - echo " ln -s ../lib/llvm/bin/aompcc \$RPM_BUILD_ROOT$copyPath/bin/aompcc" - echo " fi" - echo " if [ -e \$RPM_BUILD_ROOT$installPath/bin/mymcpu ]; then" - echo " ln -s ../lib/llvm/bin/mymcpu \$RPM_BUILD_ROOT$copyPath/bin/mymcpu" - echo " fi" - echo " if [ -e \$RPM_BUILD_ROOT$installPath/bin/mygpu ]; then" - echo " ln -s ../lib/llvm/bin/mygpu \$RPM_BUILD_ROOT$copyPath/bin/mygpu" - echo " fi" - echo " ls \$RPM_BUILD_ROOT$copyPath" - - # Create symbolic links for openmp header files - echo " ln -s ../../../../include/omp.h \$RPM_BUILD_ROOT/$installPath/lib/clang/$llvm_ver/include/omp.h" - echo " ln -s ../../../../include/ompt.h \$RPM_BUILD_ROOT/$installPath/lib/clang/$llvm_ver/include/ompt.h" - echo " ln -s ../../../../include/omp-tools.h \$RPM_BUILD_ROOT/$installPath/lib/clang/$llvm_ver/include/omp-tools.h" - echo "%endif" - echo 'find $RPM_BUILD_ROOT \! -type d | sed "s|$RPM_BUILD_ROOT||"> files.list' - # Copy examples - - echo "%if %is_runtime" - # Licensing - # Copy licenses into share/doc/openmp-extras - echo " mkdir -p \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras" - echo " cp -r $AOMP_REPOS/aomp/LICENSE \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras/LICENSE.apache2" - echo " cp -r $AOMP_REPOS/aomp-extras/LICENSE \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras/LICENSE.mit" - echo " cp -r $AOMP_REPOS/flang/LICENSE.txt \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras/LICENSE.flang" - echo "%else" - # Copy devel examples to share/openmp-extras/examples - echo " mkdir -p \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples" - echo " cp -r $AOMP_REPOS/aomp/examples/fortran \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples" - echo " cp -r $AOMP_REPOS/aomp/examples/openmp \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples" - echo " cp -r $AOMP_REPOS/aomp/examples/tools \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples" - if [ -e "$AOMP_REPOS/aomp/examples/Makefile.help" ]; then - echo " cp $AOMP_REPOS/aomp/examples/Makefile* \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples" - fi - clean_examples \$RPM_BUILD_ROOT$copyPath/share/openmp-extras/examples - echo "%endif" - echo "%clean" - echo "rm -rf \$RPM_BUILD_ROOT" - - echo "%files -f files.list" - echo "%if %is_runtime" - echo " $copyPath/share/doc/openmp-extras" - echo "%else" - echo " $copyPath/share/openmp-extras" - echo "%endif" - echo "%defattr(-,root,root,-)" - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by - # openmp-extras runtime and devel package - echo "%if %is_runtime || %is_devel" - echo " $copyPath" - echo "%endif" - - } > $specFile - rpmbuild --define "_topdir $packageRpm" -ba $specFile - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH -} - -# ASAN RPM packaging -package_openmp_extras_asan_rpm() { - # RPM packaging - local packageName=$1 - local packageRpm="$packageDir/rpm" - local specFile="$packageDir/$packageName.spec" - local packageSummary="AddressSanitizer OpenMP Extras provides instrumented openmp and flang libraries." - local packageSummaryLong="openmp-extras $packageVersion is based on LLVM 17 and is used for offloading to Radeon GPUs." - local rpmRequires="hsa-rocr-asan, rocm-core-asan" - # After build,runtime folder will have ASAN libaries. - local asanLibDir="runtime" - - # Cleanup previous packages - rm -rf "$packageDir" - rm -rf "$RPM_PATH" - mkdir -p "$RPM_PATH" - echo RPM_PATH: $RPM_PATH - echo mkdir -p $(dirname $specFile) - mkdir -p "$(dirname $specFile)" - - { - echo "Name: $packageName" - echo "Version: $packageVersion" - echo "Release: ${CPACK_RPM_PACKAGE_RELEASE}%{?dist}" - echo "Summary: $packageSummary" - echo "Group: System Environment/Libraries" - echo "License: MIT and ASL 2.0 and ASL 2.0 with exceptions" - echo "Vendor: Advanced Micro Devices, Inc." - echo "Requires: $rpmRequires" - # Redefining __os_install_post to prevent binary stripping - echo "%define __os_install_post %{nil}" - echo "%description" - echo "%undefine _debugsource_packages" - echo "$packageSummaryLong" - - echo "%prep" - echo "%setup -T -D -c -n $packageName" - echo "%build" - - echo "%install" - echo "if [ -f $BUILD_PATH/build/installed_files.txt ] && [ ! -d "$INSTALL_PREFIX"/openmp-extras ]; then" - echo " cat $BUILD_PATH/build/installed_files.txt | grep -P 'asan' | cut -d':' -f2 | cut -d' ' -f2 | xargs -I {} cp -d --parents {} \$RPM_BUILD_ROOT" - # libgomp and libiomp5 are not on the install_manifest.txt and need - # to be manually copied. Waiting on trunk patch to flow into amd-staging - # to ensure these symlinks are in the manifest. - echo " cp -d --parents "$installPath/lib/asan/libgomp.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib/asan/libiomp5.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib-debug/asan/libgomp.so" \$RPM_BUILD_ROOT" - echo " cp -d --parents "$installPath/lib-debug/asan/libiomp5.so" \$RPM_BUILD_ROOT" - # FIXME: Old packaging method, can delete once new packaging lands. - echo "else" - # Copy openmp-extras ASAN libraries to ASAN folders - echo " mkdir -p \$RPM_BUILD_ROOT$installPath/lib/asan" - echo " mkdir -p \$RPM_BUILD_ROOT$installPath/lib-debug/asan" - echo " cp -r $AOMP/lib/asan/* \$RPM_BUILD_ROOT$installPath/lib/asan" - echo " cp -r $AOMP/lib-debug/asan/* \$RPM_BUILD_ROOT$installPath/lib-debug/asan" - echo " cp -r $AOMP/$asanLibDir/lib/asan/* \$RPM_BUILD_ROOT$installPath/lib/asan" - echo " cp -r $AOMP/$asanLibDir/lib-debug/asan/* \$RPM_BUILD_ROOT$installPath/lib-debug/asan" - echo " cp -r $AOMP/devel/lib/asan/* \$RPM_BUILD_ROOT$installPath/lib/asan" - echo " cp -r $AOMP/devel/lib-debug/asan/* \$RPM_BUILD_ROOT$installPath/lib-debug/asan" - echo "fi" - - # Create symbolic links from /opt/rocm/bin to /opt/rocm/lib/llvm/bin utilities - echo 'find $RPM_BUILD_ROOT \! -type d | sed "s|$RPM_BUILD_ROOT||"> files.list' - - # Licensing - # Copy licenses into share/doc/openmp-extras - echo " mkdir -p \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras-asan" - echo " cp -r $AOMP_REPOS/aomp/LICENSE \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras-asan/LICENSE.apache2" - echo " cp -r $AOMP_REPOS/aomp-extras/LICENSE \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras-asan/LICENSE.mit" - echo " cp -r $AOMP_REPOS/flang/LICENSE.txt \$RPM_BUILD_ROOT$copyPath/share/doc/openmp-extras-asan/LICENSE.flang" - echo "%clean" - echo "rm -rf \$RPM_BUILD_ROOT" - - echo "%files -f files.list" - echo " $copyPath/share/doc/openmp-extras-asan" - echo "%defattr(-,root,root,-)" - # Note: In some OS like SLES, during upgrade rocm-core is getting upgraded first and followed by other packages - # rocm-core cannot delete rocm-ver folder, since it contains files of other packages that are yet to be upgraded - # To remove rocm-ver folder after upgrade the spec file of other packages should contain the rocm-ver directory - # Otherwise after upgrade empty old rocm-ver folder will be left out. - # If empty remove /opt/rocm-ver folder and its subdirectories created by - # openmp-extras runtime and devel package - echo " $copyPath" - - } > $specFile - rpmbuild --define "_topdir $packageRpm" -ba $specFile - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH -} - -package_openmp_extras() { - local DISTRO_NAME=$(cat /etc/os-release | grep -e ^NAME=) - local installPath="$ROCM_INSTALL_PATH/lib/llvm" - local copyPath="$ROCM_INSTALL_PATH" - local packageDir="$BUILD_PATH/package" - local llvm_ver=`$INSTALL_PREFIX/lib/llvm/bin/clang --print-resource-dir | sed 's^/llvm/lib/clang/^ ^' | awk '{print $2}'` - local debNames="openmp-extras-runtime openmp-extras-dev" - local rpmNames="openmp-extras-runtime openmp-extras-devel" - ompdSrcDir="$INSTALL_PREFIX/lib/llvm/share/gdb/python/ompd/src" - if [ "$SANITIZER" == "1" ]; then - local asanPkgName="openmp-extras-asan" - if [[ $DISTRO_NAME =~ "Ubuntu" ]] || [[ $DISTRO_NAME =~ "Debian" ]]; then - echo "Warning: Assuming DEBs" - package_openmp_extras_asan_deb $asanPkgName - else - echo "Warning: Assuming RPMs" - package_openmp_extras_asan_rpm $asanPkgName - fi - # For ASAN build, create only ASAN package - # Devel and runtime pkg should be created from non-asan build. So return the execution - return 0 - fi - # Only build deb in Ubuntu environment - if [[ $DISTRO_NAME =~ "Ubuntu" ]] || [[ $DISTRO_NAME =~ "Debian" ]]; then - echo "Warning: Assuming DEBs" - for name in $debNames; do - package_openmp_extras_deb $name - done - # Only build RPM in CENTOS/SLES environment - else - echo "Warning: Assuming RPMs" - for name in $rpmNames; do - package_openmp_extras_rpm $name - done - fi -} - -package_tests_deb(){ - # Openmp-extras debian test packaging - local packageDir="$BUILD_PATH/package" - local packageDeb="$packageDir/deb" - local packageArch="amd64" - local packageMaintainer="Openmp Extras Support " - local packageSummary="Tests for openmp-extras." - local packageSummaryLong="Tests for openmp-extras $packageMajorVersion-$packageMinorVersion is based on LLVM 17 and is used for offloading to Radeon GPUs." - local debDependencies="openmp-extras-dev, rocm-core" - local debRecommends="" - local controlFile="$packageDeb/openmp-extras/DEBIAN/control" - local installPath="$ROCM_INSTALL_PATH/share/openmp-extras/tests" - local packageName="openmp-extras-tests" - - # Cleanup previous packages - rm -rf "$packageDir" - - mkdir -p $packageDeb/openmp-extras"$installPath" - if [ -e $(dirname $controlFile) ]; then - rm $(dirname $controlFile) - fi - mkdir -p "$(dirname $controlFile)" - # Copy openmp-extras files - cp -r "$AOMP_REPOS/aomp/." "$packageDeb/openmp-extras/$installPath" - rm -rf "$packageDeb"/openmp-extras"$installPath"/.git "$packageDeb"/openmp-extras"$installPath"/.github - # Copy FileCheck - if [ -f "$OUT_DIR"/build/lightning/bin/FileCheck ]; then - cp "$OUT_DIR/build/lightning/bin/FileCheck" "$packageDeb/openmp-extras/$installPath/bin" - fi - - # Create control file - { - echo "Package: $packageName" - echo "Architecture: $packageArch" - echo "Section: devel" - echo "Priority: optional" - echo "Maintainer: $packageMaintainer" - echo "Version: $packageVersion-${CPACK_DEBIAN_PACKAGE_RELEASE}" - echo "Depends: $debDependencies" - echo "Recommends: $debRecommends" - echo "Description: $packageSummary" - echo " $packageSummaryLong" - } > $controlFile - fakeroot dpkg-deb -Zgzip --build $packageDeb/openmp-extras \ - "${DEB_PATH}/${packageName}_${packageVersion}-${CPACK_DEBIAN_PACKAGE_RELEASE}_${packageArch}.deb" -} - -package_tests_rpm(){ - # RPM packaging - AOMP_STANDALONE_BUILD=1 $AOMP_REPOS/aomp/bin/build_fixups.sh - local copyPath="$ROCM_INSTALL_PATH" - local packageDir="$BUILD_PATH/package" - local packageRpm="$packageDir/rpm" - local installPath="$ROCM_INSTALL_PATH/share/openmp-extras/tests" - local packageName="openmp-extras-tests" - local rpmRequires="openmp-extras-devel, rocm-core" - local specFile="$packageDir/$packageName.spec" - local packageSummary="Tests for openmp-extras." - local packageSummaryLong="Tests for openmp-extras $packageVersion is based on LLVM 18 and is used for offloading to Radeon GPUs." - - # Cleanup previous packages - rm -rf "$packageDir" - mkdir -p "$packageRpm/openmp-extras/$installPath" - { - echo "AutoReqProv: no" - echo "Name: $packageName" - echo "Version: $packageVersion" - echo "Release: ${CPACK_RPM_PACKAGE_RELEASE}%{?dist}" - echo "Summary: $packageSummary" - echo "Group: System Environment/Libraries" - echo "License: Advanced Micro Devices, Inc." - echo "Vendor: Advanced Micro Devices, Inc." - echo "Prefix: $INSTALL_PREFIX" - echo "Requires: $rpmRequires" - echo "%define debug_package %{nil}" - # Redefining __os_install_post to remove stripping - echo "%define __os_install_post %{nil}" - echo "%description" - echo "$packageSummaryLong" - - echo "%prep" - echo "%setup -T -D -c -n $packageName" - echo "%build" - - echo "%install" - echo "mkdir -p \$RPM_BUILD_ROOT$installPath" - echo "cp -R $AOMP_REPOS/aomp/. \$RPM_BUILD_ROOT$installPath" - echo "rm -rf \$RPM_BUILD_ROOT$installPath/.git \$RPM_BUILD_ROOT$installPath/.github" - echo "if [ -f $OUT_DIR/build/lightning/bin/FileCheck ]; then" - echo " cp $OUT_DIR/build/lightning/bin/FileCheck \$RPM_BUILD_ROOT$installPath/bin" - echo "fi" - echo 'find $RPM_BUILD_ROOT \! -type d | sed "s|$RPM_BUILD_ROOT||"> files.list' - - echo "%clean" - echo "rm -rf \$RPM_BUILD_ROOT" - - echo "%files -f files.list" - echo "$installPath" - echo "%defattr(-,root,root,-)" - - echo "%postun" - echo "rm -rf $installPath" - } > $specFile - rpmbuild --define "_topdir $packageRpm" -ba $specFile - mv $packageRpm/RPMS/x86_64/*.rpm $RPM_PATH -} - -package_tests() { - local DISTRO_NAME=$(cat /etc/os-release | grep -e ^NAME=) - # Only build deb in Ubuntu environment - if [[ $DISTRO_NAME =~ "Ubuntu" ]]; then - package_tests_deb - # Only build RPM in CENTOS/SLES environment - else - package_tests_rpm - fi -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_openmp_extras - ;; - (build) - build_openmp_extras - package_openmp_extras - package_tests - build_wheel "$BUILD_PATH" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rccl.sh b/tools/rocm-build/build_rccl.sh deleted file mode 100755 index 3a38bf192..000000000 --- a/tools/rocm-build/build_rccl.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rccl - -build_rccl() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - mkdir -p $ROCM_PATH/.info/ - echo $ROCM_VERSION | tee $ROCM_PATH/.info/version - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - mkdir -p $BUILD_DIR && cd $BUILD_DIR - - init_rocm_common_cmake_params - - CC=${ROCM_PATH}/bin/amdclang \ - CXX=$(set_build_variables __CXX__) \ - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - -DHIP_COMPILER=clang \ - -DCMAKE_PREFIX_PATH="${ROCM_PATH};${ROCM_PATH}/share/rocm/cmake/" \ - ${LAUNCHER_FLAGS} \ - -DCPACK_GENERATOR="${PKGTYPE^^}" \ - -DROCM_PATCH_VERSION=$ROCM_LIBPATCH_VERSION \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -DBUILD_TESTS=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rccl() { - echo "Cleaning rccl build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rccl; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rccl ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rdc.sh b/tools/rocm-build/build_rdc.sh deleted file mode 100755 index 798295066..000000000 --- a/tools/rocm-build/build_rdc.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -set -ex - -### Set up RPATH for RDC to simplify finding RDC libraries. Please note that -### ROCm has a setup_env.sh script which already populates these variables. -### These variables are then used inside compute_utils.sh. -### -### We need to append additional paths to these variables BEFORE sourcing -### compute_utils.sh - -# lib/rdc/librdc_rocp.so needs lib/librdc_bootstrap.so -# this also covers the ASAN usecase -ROCM_LIB_RPATH=$ROCM_LIB_RPATH:'$ORIGIN/..' -# grpc -ROCM_LIB_RPATH=$ROCM_LIB_RPATH:'$ORIGIN/rdc/grpc/lib' -ROCM_LIB_RPATH=$ROCM_LIB_RPATH:'$ORIGIN/grpc/lib' -# help RDC executables find RDC libraries -# lib/librdc_bootstrap.so.0 and grpc -ROCM_EXE_RPATH=$ROCM_EXE_RPATH:'$ORIGIN/../lib/rdc/grpc/lib' -if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - ROCM_EXE_RPATH="$ROCM_ASAN_EXE_RPATH:$ROCM_EXE_RPATH" -fi - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rdc - -# RDC -# BUILD ARGUMENTS -BUILD_DOCS="no" -GRPC_PROTOC_ROOT="${BUILD_DIR}/grpc" -GRPC_SEARCH_ROOT="/usr/grpc" -GRPC_DESIRED_VERSION="1.67.1" # do not include 'v' -# lib/librocm_smi64.so and lib/libamd_smi.so - -# check if exact version of gRPC is installed -find_grpc() { - grep -s -F "$GRPC_DESIRED_VERSION" ${GRPC_SEARCH_ROOT}/*/cmake/grpc/gRPCConfigVersion.cmake && - GRPC_PROTOC_ROOT=$GRPC_SEARCH_ROOT -} - -build_rdc() { - if ! find_grpc; then - echo "ERROR: GRPC SEARCH FAILED!" - echo "You are expected to have gRPC [${GRPC_DESIRED_VERSION}] in [${GRPC_SEARCH_ROOT}]" - # Compiling gRPC as part of the RDC build takes too long and times out the build job - return 1 - fi - echo "gRPC [${GRPC_DESIRED_VERSION}] found!" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - CXX=$(set_build_variables __C_++__) - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # NOTE: Temp fix for ASAN failures SWDEV-515858 - export ASAN_OPTIONS="detect_leaks=0:new_delete_type_mismatch=0" - fi - - echo "Building RDC" - echo "RDC_BUILD_DIR: ${RDC_BUILD_DIR}" - echo "GRPC_PROTOC_ROOT: ${GRPC_PROTOC_ROOT}" - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - # NOTE: Temp workaround for libasan not being first in the library list. - # libasan not being first causes ADDRESS_SANITIZER builds to fail. - # This value is set by set_asan_env_vars. Which is only called when -a arg is passed. - export LD_PRELOAD="$ASAN_LIB_PATH" - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - init_rocm_common_cmake_params - if [ ! -d "$BUILD_DIR/rdc_libs" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - cmake \ - -DGRPC_ROOT="$GRPC_PROTOC_ROOT" \ - -DGRPC_DESIRED_VERSION="$GRPC_DESIRED_VERSION" \ - -DCMAKE_MODULE_PATH="$COMPONENT_SRC/cmake_modules" \ - "${rocm_math_common_cmake_params[@]}" \ - -DCPACK_GENERATOR="${PKGTYPE^^}" \ - -DROCM_DIR=$ROCM_PATH \ - -DCPACK_PACKAGE_VERSION_MAJOR="1" \ - -DCPACK_PACKAGE_VERSION_MINOR="$ROCM_LIBPATCH_VERSION" \ - -DCPACK_PACKAGE_VERSION_PATCH="0" \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DBUILD_TESTS=ON \ - -DBUILD_PROFILER=ON \ - -DBUILD_RVS=ON \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE \ - "$COMPONENT_SRC" - popd - fi - echo "Making rdc package:" - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - # NOTE: Must disable LD_PRELOAD hack before packaging! - # cmake fails with cryptic error on RHEL: - # - # AddressSanitizer:DEADLYSIGNAL - # ==17083==ERROR: AddressSanitizer: stack-overflow on address ... - # - # The issue is likely in python3.6 cpack scripts - unset LD_PRELOAD - fi - - cmake --build "$BUILD_DIR" -- package - - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - if [ "$BUILD_DOCS" = "yes" ]; then - echo "Building Docs" - cmake --build "$BUILD_DIR" -- doc - pushd "$BUILD_DIR"/latex - cmake --build . -- - mv refman.pdf "$ROCM_PATH/rdc/RDC_Manual.pdf" - popd - fi -} - -clean_rdc() { - echo "Cleaning RDC build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - return 0 -} - -stage2_command_args "$@" -disable_debug_package_generation - -case $TARGET in - clean) clean_rdc ;; - build) build_rdc ;; - outdir) print_output_directory ;; - *) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocal.sh b/tools/rocm-build/build_rocal.sh deleted file mode 100755 index c5234f0bc..000000000 --- a/tools/rocm-build/build_rocal.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocAL - -build_rocal() { - - if [ "$DISTRO_ID" = "mariner-2.0" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ] ; then - echo "Not building rocal for ${DISTRO_ID}. Exiting..." - return 0 - fi - - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - # Enable ASAN - # Temporarily disable ASAN for rocal - SWDEV-471302 - #if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - # set_asan_env_vars - # set_address_sanitizer_on - #fi - pushd /tmp - - # PyBind11 - rm -rf pybind11 - git clone -b v2.11.1 https://github.com/pybind/pybind11 - cd pybind11 && mkdir build && cd build - cmake -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON ../ - make -j$(nproc) && sudo make install - cd ../.. - - # Turbo JPEG - rm -rf libjpeg-turbo - git clone -b 3.0.2 https://github.com/libjpeg-turbo/libjpeg-turbo.git - cd libjpeg-turbo && mkdir build && cd build - cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib -DWITH_JPEG8=TRUE .. - make -j$(nproc) && sudo make install - cd ../.. - - # RapidJSON - rm -rf rapidjson - git clone https://github.com/Tencent/rapidjson.git - cd rapidjson && mkdir build && cd build - cmake .. && make -j$(nproc) && sudo make install - popd - - mkdir -p $BUILD_DIR && cd $BUILD_DIR - - # python3 ../rocAL-setup.py - - if [[ "${DISTRO_ID}" == almalinux-8* ]]; then - cmake -DPYTHON_VERSION_SUGGESTED=3.8 -DAMDRPP_PATH=$ROCM_PATH ${COMPONENT_SRC} - else - cmake -DAMDRPP_PATH=$ROCM_PATH ${COMPONENT_SRC} - fi - make -j8 - cmake --build . --target PyPackageInstall - make package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_rocal() { - echo "Cleaning rocAL build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocal; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocal ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocalution.sh b/tools/rocm-build/build_rocalution.sh deleted file mode 100755 index 17e7673a3..000000000 --- a/tools/rocm-build/build_rocalution.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -PATH=${ROCM_PATH}/bin:$PATH -set_component_src rocALUTION - -build_rocalution() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - - CXX=$(set_build_variables __G_++__) - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - cmake \ - -DSUPPORT_HIP=ON \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocalution() { - echo "Cleaning rocALUTION build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocalution; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocalution ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocblas.sh b/tools/rocm-build/build_rocblas.sh deleted file mode 100755 index cb232699f..000000000 --- a/tools/rocm-build/build_rocblas.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocBLAS -DEPS_DIR=${HOME}/rocblas - -stage2_command_args "$@" -disable_debug_package_generation - -build_rocblas() { - echo "Start build" - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - #Removed GPU ARCHS from here as it will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - # Temporary workaround for rocBLAS to build with ASAN as suggested in #SWDEV-314505 - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - export ASAN_OPTIONS="detect_leaks=0:verify_asan_link_order=0" - # updating GPU_ARCHS for ASAN build to supported gpu arch only SWDEV-479178 - #GPU_ARCHS="gfx90a:xnack+;gfx942:xnack+" #This will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - fi - LAZY_LOADING=ON - SEPARATE_ARCHES=ON - cd $COMPONENT_SRC - - CXX=$(set_build_variables __AMD_CLANG_++__) - mkdir -p $DEPS_DIR && cp -r /usr/blis $DEPS_DIR - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - # if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value. This will override any of the case values above - if [ -n "$ENABLE_GPU_ARCH" ]; then - #setting gfx arch as part of rocm_common_cmake_params - set_gpu_arch "${ENABLE_GPU_ARCH}" - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - - init_rocm_common_cmake_params - cmake \ - -DCMAKE_TOOLCHAIN_FILE=toolchain-linux.cmake \ - -DBUILD_DIR="${BUILD_DIR}" \ - "${rocm_math_common_cmake_params[@]}" \ - -DROCM_DIR="${ROCM_PATH}" \ - ${LAUNCHER_FLAGS} \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DCMAKE_PREFIX_PATH="${DEPS_DIR};${ROCM_PATH}" \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DLINK_BLIS=ON \ - -DTensile_CODE_OBJECT_VERSION=default \ - -DTensile_LOGIC=asm_full \ - -DTensile_SEPARATE_ARCHITECTURES="${SEPARATE_ARCHES}" \ - -DTensile_LAZY_LIBRARY_LOADING="${LAZY_LOADING}" \ - -DTensile_LIBRARY_FORMAT=msgpack \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -DTENSILE_VENV_UPGRADE_PIP=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && rm -rf ./library/src/build_tmp && find -name '*.o' -delete - - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocblas() { - echo "Cleaning rocBLAS build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -case $TARGET in - build) build_rocblas; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocblas ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocclr.sh b/tools/rocm-build/build_rocclr.sh deleted file mode 100755 index e9aa829c9..000000000 --- a/tools/rocm-build/build_rocclr.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -#// Currently, roccler does not supports .so but, this change makes this script future -# ready & We shall not have to change anything at that time. Also its not doing deviating -# from the current functionalities currently as well -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...] [make options]" - echo - echo "Options:" - echo " -h, --help Prints this help" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -MAKEOPTS="$DASH_JAY" - -BUILD_PATH="$(getBuildPath rocclr)" - -TARGET="build" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_DEB="$(getPackageRoot)/deb/rocclr" -PACKAGE_RPM="$(getPackageRoot)/rpm/rocclr" -CORE_BUILD_DIR="$(getBuildPath hsa-core)" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcraso: --long help,clean,release,static,address_sanitizer,outdir: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_rocclr() { - # Delete cmake output directory - rm -rf "$BUILD_PATH" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" -} - -build_rocclr() { - # rocclr is now a part of clr repo. - # also it does not need to be built independently when build shared libs. - # might be needed when building static libs. so leave it place for static libs. - if [ "$SHARED_LIBS" = "ON" ]; then - echo "rocclr not a standalone repo. skipping build" >&2 - echo "rocclr not a standalone repo. skipping build" - exit 0 # This is not an error - fi - - if [ ! -e "$CLR_ROOT/CMakeLists.txt" ]; then - # We are in a branch that has migrated to clr repo - _ROCclr_CMAKELIST_DIR="$CLR_ROOT" - elif [ ! -e "$ROCclr_ROOT/CMakeLists.txt" ]; then - # We seem to have hit a branch in which both the old and new repo don't exist - echo "No $ROCclr_ROOT/CMakeLists.txt file, skipping rocclr" >&2 - echo "No $ROCclr_ROOT/CMakeLists.txt file, skipping rocclr" - exit 0 # This is not an error - else - # We are in a branch that has not yet migrated to clr repo - _ROCclr_CMAKELIST_DIR="$ROCclr_ROOT" - fi - echo "$_ROCclr_CMAKELIST_DIR" - mkdir -p "$BUILD_PATH" - pushd "$BUILD_PATH" - print_lib_type $SHARED_LIBS - if [ ! -e Makefile ]; then - echo "Building ROCclr CMake environment" - - cmake -DUSE_COMGR_LIBRARY=ON \ - $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DLLVM_INCLUDES="$LLVM_ROOT/include" \ - $(rocm_common_cmake_params) \ - "$_ROCclr_CMAKELIST_DIR" - - echo "CMake complete" - fi - - echo "Building ROCclr" - cmake --build . -- $MAKEOPTS "VERBOSE=1" - - popd -} - -# When use -o option, the code should directly exit. -# The rest part of the code will not execute. -# Otherwise, it will cause an error of the caller code. -case $TARGET in - (clean) clean_rocclr ;; - (build) build_rocclr ;; - (outdir) exit ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocdecode.sh b/tools/rocm-build/build_rocdecode.sh deleted file mode 100755 index d035929de..000000000 --- a/tools/rocm-build/build_rocdecode.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" -set_component_src rocDecode -BUILD_DEV=ON -build_rocdecode() { - if [ "$DISTRO_ID" = "centos-7" ] || \ - [ "$DISTRO_ID" = "mariner-2.0" ] || \ - [ "$DISTRO_ID" = "azurelinux-3.0" ] || \ - [ "$DISTRO_ID" = "debian-10" ]; then - echo "Not building rocDecode for ${DISTRO_ID}. Exiting..." - return 0 - fi - - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - mkdir -p $BUILD_DIR && cd $BUILD_DIR - # for i in {1..5}; do - # python3 ../rocDecode-setup.py --developer OFF && break || { - # echo "Attempt $i failed! Retrying in $((i * 30)) seconds..." - # sleep $((i * 30)) - # } - # done - # python3 ${COMPONENT_SRC}/rocDecode-setup.py --developer OFF - - init_rocm_common_cmake_params - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - -DROCM_DEP_ROCMCORE=ON \ - -DROCDECODE_ENABLE_ROCPROFILER_REGISTER=ON \ - "${COMPONENT_SRC}" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} -clean_rocdecode() { - echo "Cleaning rocDecode build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} -stage2_command_args "$@" -case $TARGET in - build) build_rocdecode; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocdecode ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocfft.sh b/tools/rocm-build/build_rocfft.sh deleted file mode 100755 index eb821bbf8..000000000 --- a/tools/rocm-build/build_rocfft.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -PATH=${ROCM_PATH}/bin:$PATH -set_component_src rocFFT - -build_rocfft() { - echo "Start Build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - #Removed GPU ARCHS from here as it will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - - # Work around for HIP sources with C++ suffix, and force CXXFLAGS for both - # HIP and C++ compiles - CXX=$(set_build_variables __HIP_CC__) \ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DUSE_HIP_CLANG=ON \ - -DHIP_COMPILER=clang \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_RIDER=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocfft() { - echo "Cleaning rocFFT build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocfft; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocfft ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocjpeg.sh b/tools/rocm-build/build_rocjpeg.sh deleted file mode 100755 index 5ab8bfddb..000000000 --- a/tools/rocm-build/build_rocjpeg.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" -set_component_src rocJPEG -BUILD_DEV=ON -build_rocjpeg() { - if [ "$DISTRO_ID" = "centos-7" ] || [ "$DISTRO_ID" = "sles-15.4" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ] || [ "$DISTRO_ID" = "debian-10" ]; then - echo "Not building rocJPEG for ${DISTRO_ID}. Exiting..." - return 0 - fi - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - mkdir -p $BUILD_DIR && cd $BUILD_DIR - # python3 ../rocJPEG-setup.py - - cmake -DROCM_DEP_ROCMCORE=ON -DROCJPEG_ENABLE_ROCPROFILER_REGISTER=ON "$COMPONENT_SRC" - make -j8 - make install - make package - - cmake --build "$BUILD_DIR" -- -j${PROC} - cpack -G ${PKGTYPE^^} - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} -clean_rocjpeg() { - echo "Cleaning rocJPEG build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} -stage2_command_args "$@" -case $TARGET in - build) build_rocjpeg ;; - outdir) print_output_directory ;; - clean) clean_rocjpeg ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocm-cmake.sh b/tools/rocm-build/build_rocm-cmake.sh deleted file mode 100755 index 86e071ac2..000000000 --- a/tools/rocm-build/build_rocm-cmake.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Build a release version of the package" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocm-cmake. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -p, --package Specify packaging format" - echo " -h, --help Prints this help" - echo - echo - - return 0 -} - -## ROCm cmake build (using Makefile) environment variables -PROJ_NAME="rocm-cmake" -TARGET="build" -PACKAGE_ROOT="$(getPackageRoot)" - -## ROCm cmake build (using CMake) environment variables -ROCM_CMAKE_BUILD_DIR="$(getBuildPath $PROJ_NAME)" -ROCM_CMAKE_PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -ROCM_CMAKE_PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -ROCM_CMAKE_BUILD_TYPE="debug" -BUILD_TYPE="Debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" -MAKETARGET="deb" - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - ack_and_ignore_asan ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_rocm_cmake() { - rm -rf $ROCM_CMAKE_BUILD_DIR - rm -rf $ROCM_CMAKE_PACKAGE_DEB - rm -rf $ROCM_CMAKE_PACKAGE_RPM -} - -build_rocm_cmake() { - echo "Building ROCm cmake" - - if [ ! -d "$ROCM_CMAKE_BUILD_DIR" ]; then - mkdir -p "$ROCM_CMAKE_BUILD_DIR" - pushd "$ROCM_CMAKE_BUILD_DIR" - - cmake \ - $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DCPACK_SET_DESTDIR="OFF" \ - -DROCM_DISABLE_LDCONFIG=ON \ - $ROCM_CMAKE_ROOT - cmake --build . -- install - cmake --build . -- package - popd - fi - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$ROCM_CMAKE_PACKAGE_DEB" $ROCM_CMAKE_BUILD_DIR/rocm-cmake*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$ROCM_CMAKE_PACKAGE_RPM" $ROCM_CMAKE_BUILD_DIR/rocm-cmake*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${ROCM_CMAKE_PACKAGE_DEB};; - ("rpm") - echo ${ROCM_CMAKE_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) - clean_rocm_cmake - ;; - (build) - build_rocm_cmake - build_wheel "$ROCM_CMAKE_BUILD_DIR" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocm-core.sh b/tools/rocm-build/build_rocm-core.sh deleted file mode 100755 index a80f10980..000000000 --- a/tools/rocm-build/build_rocm-core.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocm-core. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## ROCm build (using CMake) environment variables -PROJ_NAME="rocm-core" -PACKAGE_ROOT="$(getPackageRoot)" -ROCM_CORE_BUILD_DIR="$(getBuildPath rocm_core)" -ROCM_CORE_PACKAGE_DEB="$(getPackageRoot)/deb/$PROJ_NAME" -ROCM_CORE_PACKAGE_RPM="$(getPackageRoot)/rpm/$PROJ_NAME" -ROCM_CORE_MAKE_OPTS="$DASH_JAY -C $ROCM_CORE_BUILD_DIR" -BUILD_TYPE="Debug" -TARGET="build" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" -ADDRESS_SANITIZER=false - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,address_sanitizer,outdir,wheel:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - ADDRESS_SANITIZER=true ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package ) - MAKETARGET=$2 ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_rocm_core() { - rm -rf "$ROCM_CORE_BUILD_DIR" - rm -rf "$ROCM_CORE_PACKAGE_DEB" - rm -rf "$ROCM_CORE_PACKAGE_RPM" -} - -build_rocm_core() { - echo "Building rocm-core " - - if [ ! -d "$ROCM_CORE_BUILD_DIR" ]; then - mkdir -p "$ROCM_CORE_BUILD_DIR" - fi - pushd "$ROCM_CORE_BUILD_DIR" - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DCPACK_DEBIAN_PACKAGE_RELEASE=$CPACK_DEBIAN_PACKAGE_RELEASE \ - -DCPACK_RPM_PACKAGE_RELEASE=$CPACK_RPM_PACKAGE_RELEASE \ - -DROCM_VERSION="$ROCM_VERSION" \ - -DBUILD_ID="$BUILD_ID" \ - $ROCM_CORE_ROOT - - make && make install && make package - popd - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$ROCM_CORE_PACKAGE_DEB" $ROCM_CORE_BUILD_DIR/rocm*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$ROCM_CORE_PACKAGE_RPM" $ROCM_CORE_BUILD_DIR/rocm*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${ROCM_CORE_PACKAGE_DEB};; - ("rpm") - echo ${ROCM_CORE_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) - clean_rocm_core - ;; - (build) - build_rocm_core - build_wheel "$ROCM_CORE_BUILD_DIR" "$PROJ_NAME" - ;; - (outdir) - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocm-dev.sh b/tools/rocm-build/build_rocm-dev.sh deleted file mode 100755 index 19d342cf3..000000000 --- a/tools/rocm-build/build_rocm-dev.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -stage2_command_args "$@" -build_rocm-dev(){ - $(dirname "${BASH_SOURCE[0]}")/build_rocm.sh -d - mv ${OUT_DIR}/${PKGTYPE}/meta ${OUT_DIR}/${PKGTYPE}/rocm-dev -} - - -case $TARGET in - build) build_rocm-dev ;; - outdir) echo "${OUT_DIR}/${PKGTYPE}/rocm-dev" ;; - clean) rm -rf ${OUT_DIR}/${PKGTYPE}/rocm-dev ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocm-gdb.sh b/tools/rocm-build/build_rocm-gdb.sh deleted file mode 100755 index fca60f5c1..000000000 --- a/tools/rocm-build/build_rocm-gdb.sh +++ /dev/null @@ -1,597 +0,0 @@ -#!/bin/bash -source "${BASH_SOURCE%/*}/compute_utils.sh" || return -# Can't use -R or -r in here -remove_make_r_flags - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -w, --wheel Creates python wheel package of rocm-gdb. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -toStdoutStderr(){ - printf '%s\n' "$@" >&2 - printf '%s\n' "$@" -} - -linkFiles(){ - # Attempt to use hard links first for speed and save disk, - # if that fails do a copy - cp -lfR "$1" "$2" || cp -fR "$1" "$2" -} - -## Build environment variables -PROJ_NAME=rocm-gdb -TARGET=build -MAKETARGET=deb # Not currently used -BUILD_DIR=$(getBuildPath $PROJ_NAME) # e.g. out/ubuntu.16.04/16.04/build/rocm-gdb -PACKAGE_DEB=$(getPackageRoot)/deb/$PROJ_NAME # e.g. out/ubuntu.16.04/16.04/deb -PACKAGE_RPM=$(getPackageRoot)/rpm/$PROJ_NAME # e.g. out/ubuntu.16.04/16.04/rpm -MAKE_OPTS="$DASH_JAY" # e.g. -j 56 -BUG_URL="https://github.com/ROCm-Developer-Tools/ROCgdb/issues" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" -LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" -LIB_AMD_PYTHON="amdpythonlib.so" #lib name which replaces required python lib -LIB_AMD_PYTHON_DIR_PATH=${ROCM_INSTALL_PATH}/lib - - -# A curated list of things to keep. It would be safer to have a list -# of things to remove, as failing to remove something is usually much -# less harmful than removeing too much. - -tokeep=( - main${ROCM_INSTALL_PATH}/bin/rocgdb - main${ROCM_INSTALL_PATH}/bin/roccoremerge - main${ROCM_INSTALL_PATH}/share/rocgdb/python/gdb/.* - main${ROCM_INSTALL_PATH}/share/rocgdb/syscalls/amd64-linux.xml - main${ROCM_INSTALL_PATH}/share/rocgdb/syscalls/gdb-syscalls.dtd - main${ROCM_INSTALL_PATH}/share/rocgdb/syscalls/i386-linux.xml - main${ROCM_INSTALL_PATH}/share/doc/rocgdb/NOTICES.txt - main${ROCM_INSTALL_PATH}/share/doc/rocgdb/rocannotate.pdf - main${ROCM_INSTALL_PATH}/share/doc/rocgdb/rocgdb.pdf - main${ROCM_INSTALL_PATH}/share/doc/rocgdb/rocrefcard.pdf - main${ROCM_INSTALL_PATH}/share/doc/rocgdb/rocstabs.pdf - main${ROCM_INSTALL_PATH}/share/info/rocgdb/dir - main${ROCM_INSTALL_PATH}/share/info/rocgdb/annotate.info - main${ROCM_INSTALL_PATH}/share/info/rocgdb/gdb.info - main${ROCM_INSTALL_PATH}/share/info/rocgdb/stabs.info - main${ROCM_INSTALL_PATH}/share/man/man1/rocgdb.1 - main${ROCM_INSTALL_PATH}/share/man/man1/roccoremerge.1 - main${ROCM_INSTALL_PATH}/share/man/man5/rocgdbinit.5 - main${ROCM_INSTALL_PATH}/share/html/rocannotate/.* - main${ROCM_INSTALL_PATH}/share/html/rocgdb/.* - main${ROCM_INSTALL_PATH}/share/html/rocstabs/.* -) - -keep_wanted_files(){ - ( - cd "$BUILD_DIR/package/" - # generate the keep pattern as one name per line - printf -v keeppattern '%s\n' "${tokeep[@]}" - find main/opt -type f | grep -xv "$keeppattern" | xargs -r rm - # prune empty directories - find main/opt -type d -empty -delete - ) - return 0 -} - -# Move to a function so that both package_deb and package_rpm can call -# and remove the depenency of package_rpm_tests on package_deb. -# Copy the required files to create a stand-alone testsuite. -copy_testsuite_files() { -( -dest="$BUILD_DIR/package/tests${ROCM_INSTALL_PATH}/test/gdb/" -cd "$ROCM_GDB_ROOT" -find \ - config.guess \ - config.sub \ - contrib/dg-extract-results.py \ - contrib/dg-extract-results.sh \ - gdb/contrib \ - gdb/disable-implicit-rules.mk \ - gdb/features \ - gdb/silent-rules.mk \ - gdb/testsuite \ - include/dwarf2.def \ - include/dwarf2.h \ - install-sh \ - -print0 | cpio -pdu0 "$dest" -) -} - -clean() { - echo "Cleaning $PROJ_NAME" - - rm -rf $BUILD_DIR - rm -rf $PACKAGE_DEB - rm -rf $PACKAGE_RPM -} - -# set the lexically bound variable VERSION to the current version -# A passed parameter gives the default -# Note that this might need to be stripped further as it might have -# things like "-git" which is not acceptable as a version to rpm. -get_version(){ - VERSION=$(sed -n 's/^.*char version[^"]*"\([^"]*\)".*;.*/\1/p' $BUILD_DIR/gdb/version.c || : ) - VERSION=${VERSION:-$1} -} - -package_deb(){ - # Package main binary. - # TODO package documentation when we build some. - mkdir -p "$BUILD_DIR/package/main/DEBIAN" - # Extract version from build - local VERSION - get_version unknown - # add upgrade related version sub-field - VERSION="${VERSION}.${ROCM_LIBPATCH_VERSION}" - - #create postinstall and prerm - grep -v '^# ' > "$BUILD_DIR/package/main/DEBIAN/postinst" < "$BUILD_DIR/package/main/DEBIAN/prerm" < "$BUILD_DIR/debian/control" < -Description: ROCgdb - This is ROCgdb, the AMD ROCm source-level debugger for Linux, - based on GDB, the GNU source-level debugger. -# Optional fields -Section: utils -Architecture: amd64 -Essential: no -Priority: optional -Depends: \${shlibs:Depends}, rocm-dbgapi, rocm-core, python3-dev -EOF - - # Use dpkg-shlibdeps to list shlib dependencies, the result is placed - # in $BUILD_DIR/debian/substvars. - ( - cd "$BUILD_DIR" - if [[ $ASAN_BUILD == "yes" ]] - then - LD_LIBRARY_PATH=${ROCM_INSTALL_PATH}/lib/asan:$LD_LIBRARY_PATH - fi - dpkg-shlibdeps --ignore-missing-info -e "$BUILD_DIR/package/main/${ROCM_INSTALL_PATH}/bin/rocgdb" - ) - - # Generate the final DEBIAN/control, and substitute the shlibs:Depends. - # This is a bit unorthodox as we are only using bits and pieces of the - # dpkg tools. - ( - SHLIB_DEPS=$(grep "^shlibs:Depends" "$BUILD_DIR/debian/substvars" | \ - sed -e "s/shlibs:Depends=//") - sed -E \ - -e "/^#/d" \ - -e "/^Source:/d" \ - -e "s/\\$\{shlibs:Depends\}/$SHLIB_DEPS/" \ - < debian/control > "$BUILD_DIR/package/main/DEBIAN/control" - ) - - mkdir -p "$OUT_DIR/deb/$PROJ_NAME" - fakeroot dpkg-deb -Zgzip --build "$BUILD_DIR/package/main" "$OUT_DIR/deb/$PROJ_NAME" - - # Package the tests so they can be run on a test slave - mkdir -p "$BUILD_DIR/package/tests/DEBIAN" - mkdir -p "$BUILD_DIR/package/tests/${ROCM_INSTALL_PATH}/test/gdb" - # Create control file, with variable substitution. - # Lines with # at the start are removed, to allow for comments - grep -v '^# ' > "$BUILD_DIR/package/tests/DEBIAN/control" < -Description: ROCgdb tests - Test Suite for ROCgdb -# Optional fields -Section: utils -Architecture: amd64 -Essential: no -Priority: optional -# rocm-core as policy says everything to depend on rocm-core -Depends: ${PROJ_NAME} (=${VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}), dejagnu, rocm-core, make -EOF - - copy_testsuite_files - fakeroot dpkg-deb -Zgzip --build "$BUILD_DIR/package/tests" "$OUT_DIR/deb/$PROJ_NAME" -} - -package_rpm(){ - # TODO, use this to package the tests as well. In the mean time hard code the package - set -- rocm-gdb - local packageDir="$BUILD_DIR/package_rpm/$1" # e.g. out/ubuntu-16.04/16.04/build/rocm-gdb/package_rpm/main - local specFile="$packageDir/$1.spec" # The generated spec file - local packageRpm="$packageDir/rpm" # The RPM infrastructure - # Extract version from build. If more than one line matches then - # expect failures. Solution is to find which version is the wanted one. - local VERSION - get_version 0.0.0 - # add upgrade related version sub-field - VERSION=${VERSION}.${ROCM_LIBPATCH_VERSION} - - # get the __os_install_post macro, edit it to remove the python bytecode generation - # rpm --showrc shows the default macros with priority level (-14) in this case - # so remove everything before this macro, everything after it, remove the offending line, - # and make it available as the ospost variable to insert into spec file - local ospost="$(echo '%define __os_install_post \' - rpm --showrc | sed '1,/^-14: __os_install_post/d; - /^-14:/,$d;/^%{nil}/!s/$/ \\/; - /brp-python-bytecompile/d')" - - echo "specFile: $specFile" - echo "packageRpm: $packageRpm" - - mkdir -p "$packageDir" - - # Create the spec file. - # Allow comments in the generation of the specfile, may be overkill. - grep -v '^## ' <<- EOF > $specFile -## Set up where this stuff goes -%define _topdir $packageRpm -%define _rpmfilename %%{ARCH}/%%{NAME}-${VERSION}-${CPACK_RPM_PACKAGE_RELEASE}%{?dist}.%%{ARCH}.rpm -## The __os_install_post macro on centos creates .pyc and .pyo objects -## by calling brp-python-bytecompile -## This then creates an issue as the script doesn't package these files -## override it -$ospost -## -Name: ${PROJ_NAME} -Group: Development/Tools/Debuggers -Summary: ROCm source-level debugger for Linux -## rpm requires the version to be dot separated numbers -Version: ${VERSION//-/_} -Release: ${CPACK_RPM_PACKAGE_RELEASE}%{?dist} -License: GPL -Prefix: ${ROCM_INSTALL_PATH} -Requires: rocm-core, rocm-dbgapi - -%description -This is ROCgdb, the ROCm source-level debugger for Linux, based on -GDB, the GNU source-level debugger. - -The ROCgdb documentation is available at: -https://github.com/RadeonOpenCompute/ROCm - -## these things are commented out as they are not needed, but are -## left in for documentation. -# %prep -# : Should not need to do anything in prep -# %build -# : Should not need to do anything in build as make does that -# %clean -# : Should not need to do anything in clean -## This is the meat. Get a copy of the files from where we built them -## into the local RPM_BUILD_ROOT and left the defaults take over. Need -## to quote the dollar signs as we want rpm to expand them when it is -## run, rather than the shell when we build the spec file. -%install -rm -rf \$RPM_BUILD_ROOT -mkdir -p \$RPM_BUILD_ROOT -# Get a copy of the built tree. -cp -ar $BUILD_DIR/package/main/opt \$RPM_BUILD_ROOT/opt -## The file section is generated by walking the tree. -%files -EOF - # Now generate the files - find $BUILD_DIR/package/main/opt -type d | sed "s:$BUILD_DIR/package/main:%dir :" >> $specFile - find $BUILD_DIR/package/main/opt ! -type d | sed "s:$BUILD_DIR/package/main::" >> $specFile - - rpmbuild --define "_topdir $packageRpm" -ba $specFile - # Now copy it to final location - mkdir -p "$PACKAGE_RPM" # e.g. out/ubuntu-16.04/16.04/rpm/rocm-gdb - mv $packageRpm/RPMS/x86_64/*.rpm "$PACKAGE_RPM" -} - -package_rpm_tests(){ - # TODO, use this to package the tests as well. In the mean time hard code the package - set -- rocm-gdb-tests - local packageDir="$BUILD_DIR/package_rpm/$1" # e.g. out/ubuntu-16.04/16.04/build/rocm-gdb/package_rpm/main - local specFile="$packageDir/$1.spec" # The generated spec file - local packageRpm="$packageDir/rpm" # The RPM infrastructure - # Extract version from build. If more than one line matches then - # expect failures. Solution is to find which version is the wanted one. - local VERSION - get_version 0.0.0 - # add upgrade related version sub-field - VERSION=${VERSION}.${ROCM_LIBPATCH_VERSION} - local RELEASE=${CPACK_RPM_PACKAGE_RELEASE}%{?dist} - - echo "specFile: $specFile" - echo "packageRpm: $packageRpm" - - mkdir -p "$packageRpm" - - # Create the spec file. - # Allow comments in the generation of the specfile, may be overkill. - local ospost="$(echo '%define __os_install_post \' - rpm --showrc | sed '1,/^-14: __os_install_post/d; - /^-14:/,$d;/^%{nil}/!s/$/ \\/; - /brp-python-bytecompile/d')" - grep -v '^## ' <<- EOF > $specFile -## Set up where this stuff goes -%define _topdir $packageRpm -%define _rpmfilename %%{ARCH}/%%{NAME}-${VERSION}-${RELEASE}.%%{ARCH}.rpm -## The __os_install_post macro on centos creates .pyc and .pyo objects -## by calling brp-python-bytecompile -## This then creates an issue as the script doesn't package these files -## override it -$ospost -## -Name: ${PROJ_NAME}-tests -Group: Development/Tools/Debuggers -Summary: Tests for gdb enhanced to debug AMD GPUs -Version: ${VERSION//-/_} -Release: ${RELEASE} -License: GPL -Prefix: ${ROCM_INSTALL_PATH} -Requires: dejagnu, ${PROJ_NAME} = ${VERSION//-/_}-${RELEASE}, rocm-core, make - -%description -Tests for ROCgdb - -## these things are commented out as they are not needed, but are -## left in for documentation. -# %prep -# : Should not need to do anything in prep -# %build -# : Should not need to do anything in build as make does that -# %clean -# : Should not need to do anything in clean -## This is the meat. Get a copy of the files from where we built them -## into the local RPM_BUILD_ROOT and left the defaults take over. Need -## to quote the dollar signs as we want rpm to expand them when it is -## run, rather than the shell when we build the spec file. -%install -rm -rf \$RPM_BUILD_ROOT -mkdir -p \$RPM_BUILD_ROOT -# Get a copy of the built tree. -cp -ar $BUILD_DIR/package/tests/opt \$RPM_BUILD_ROOT/opt -## The file section is generated by walking the tree. -%files -## package everything in \$RPM_BUILD_ROOT/${ROCM_INSTALL_PATH}/test. -## A little excessive but this is just an internal test package -${ROCM_INSTALL_PATH}/test -EOF - - copy_testsuite_files - - # rpm wont resolve the dependency if the unversioned python (#!/usr/bin/python) is used. - # /usr/bin/python - this file is not owned by any package. - # So find and append the version to the /usr/bin/python as /usr/bin/python3 - # By updating this, the python3 requirement will be provided by the python3 package. - find $BUILD_DIR/package/tests/opt -type f -exec sed -i '1s:^#! */usr/bin/python\>:&3:' {} + - - rpmbuild --define "_topdir $packageRpm" -ba $specFile - # Now copy it to final location - mkdir -p "$PACKAGE_RPM" # e.g. out/ubuntu-16.04/16.04/rpm/rocm-gdb - mv $packageRpm/RPMS/x86_64/*.rpm "$PACKAGE_RPM" -} - -build() { - if [ ! -e "$ROCM_GDB_ROOT/configure" ] - then - toStdoutStderr "No $ROCM_GDB_ROOT/configure file, skippping rocm-gdb" - exit 0 # This is not an error - fi - local pythonver=python3 - if [[ "$DISTRO_ID" == "ubuntu-18.04" ]]; then - pythonver=python3.8 - fi - # Workaround for rocm-gdb failure due to texlive on RHEL-9 & CentOS-9 SWDEV-339596 - if [[ "$DISTRO_ID" == "centos-9" ]] || [[ "$DISTRO_ID" == "rhel-9.0" ]]; then - fmtutil-user --missing - fi - echo "Building $PROJ_NAME" - mkdir -p "$BUILD_DIR" - cd "$BUILD_DIR" || die "Failed to cd to '$BUILD_DIR'" - # Build instructions taken from the README.ROCM with the addition - # of --with-pkgversion - # - # The "new" way of specifying the path to the amd-dbgapi library is by - # setting PKG_CONFIG_PATH. The --with-amd-dbgapi flag is used to ensure - # that if amd-dbgapi is not found, configure fails. - # - # --with-rocm-dbgapi is kept for now, to ease the transition. It can be - # removed once it is determined that we don't need to build source trees - # using the "old" way. - $ROCM_GDB_ROOT/configure --program-prefix=roc --prefix="${ROCM_INSTALL_PATH}" \ - --htmldir="\${prefix}/share/html" --pdfdir="\${prefix}/share/doc/rocgdb" \ - --infodir="\${prefix}/share/info/rocgdb" \ - --with-separate-debug-dir="\${prefix}/lib/debug:/usr/lib/debug" \ - --with-gdb-datadir="\${prefix}/share/rocgdb" --enable-64-bit-bfd \ - --with-bugurl="$BUG_URL" --with-pkgversion="${ROCM_BUILD_ID:-ROCm}" \ - --enable-targets="x86_64-linux-gnu,amdgcn-amd-amdhsa" \ - --disable-gas \ - --disable-gdbserver \ - --disable-gdbtk \ - --disable-gprofng \ - --disable-ld \ - --disable-shared \ - --disable-sim \ - --enable-tui \ - --with-amd-dbgapi \ - --with-expat \ - --with-lzma \ - --with-python=$pythonver \ - --with-rocm-dbgapi=$ROCM_INSTALL_PATH \ - --with-system-zlib \ - --with-zstd \ - --without-babeltrace \ - --without-guile \ - --without-intel-pt \ - --without-libunwind-ia64 \ - --without-xxhash \ - PKG_CONFIG_PATH="${ROCM_INSTALL_PATH}/share/pkgconfig" \ - LDFLAGS="$LDFLAGS" - LD_RUN_PATH='${ORIGIN}/../lib' make $MAKE_OPTS - - if [[ "$DISTRO_ID" == "ubuntu"* ]]; then - #changing the python lib requirement in the built gdb for ubuntu builds - REPLACE_LIB_NAME=$(ldd -d $BUILD_DIR/gdb/gdb |awk '/libpython/{print $1}') - echo "Replacing $REPLACE_LIB_NAME with $LIB_AMD_PYTHON" - patchelf --replace-needed $REPLACE_LIB_NAME $LIB_AMD_PYTHON $BUILD_DIR/gdb/gdb - fi - - mkdir -p $BUILD_DIR/package/main${ROCM_INSTALL_PATH}/{share/rocgdb,bin} - # Install gdb - make $MAKE_OPTS -C gdb DESTDIR=$BUILD_DIR/package/main install install-pdf install-html - # Install binutils for coremerge and coremerge manpage. - make $MAKE_OPTS -C binutils DESTDIR=$BUILD_DIR/package/main install - # Add in the AMD licences file - linkFiles $ROCM_GDB_ROOT/gdb/NOTICES.txt $BUILD_DIR/package/main${ROCM_INSTALL_PATH}/share/doc/rocgdb - keep_wanted_files - # If a variable CPACKGEN indicates only one type of packaging is required - # then don't bother making the other. This variable is set up in compute_utils.sh - # Default to building both package types if variable is not set - # Use "[ var = value ] || ..." rather than "[ var != value ] &&" so expression - # evaluates to true, and set -e does not cause script to exit. - [ "${CPACKGEN}" = "DEB" ] || package_rpm && package_rpm_tests - [ "${CPACKGEN}" = "RPM" ] || package_deb -} - -# See if the code exists -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -main(){ - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -ASAN_BUILD="no" -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ; MAKEARG="$MAKEARG REL=1" ;; # For compatability with other scripts - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - ASAN_BUILD="yes" ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - echo " Wheel"; WHEEL_PACKAGE=true ; shift;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) #FIXME - MAKETARGET="$2" ; shift 2;; - # I think it would be better to use -- to indicate end of args - # and insert an error message about unknown args at this point. - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac -done - -# If building with Clang, we need to build in C++17 mode, to avoid some build problems -if [[ $CXX == *"clang++" ]] -then - CXX="$CXX -std=gnu++17" -fi - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - case $TARGET in - ("clean") - clean - ;; - ("build") - build - build_wheel "$BUILD_DIR" "$PROJ_NAME" - ;; - ("outdir") - print_output_directory - ;; - (*) - die "Invalid target $TARGET" - ;; - esac - - echo "Operation complete" -} - -# If this script is not being sourced, then run it. -if [ "$0" = "$BASH_SOURCE" ] -then - main "$@" -else - set +e # Undo the damage from compute_utils.sh -fi diff --git a/tools/rocm-build/build_rocm.sh b/tools/rocm-build/build_rocm.sh deleted file mode 100755 index 57e20a465..000000000 --- a/tools/rocm-build/build_rocm.sh +++ /dev/null @@ -1,264 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -d, --devstg Build only stage1 meta packages. Without this - option script builds both stg1 and stg2" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -w, --wheel Creates python wheel package of rocm meta packages. - It needs to be used along with -r option" - echo " -s, --static Enable Support for Generating Static Meta Packages" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## ROCm build (using CMake) environment variables -PROJ_NAME="meta" -PACKAGE_ROOT="$(getPackageRoot)" -ROCM_BUILD_DIR="$(getBuildPath $PROJ_NAME)" -ROCM_PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -ROCM_PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -ROCM_MAKE_OPTS="$DASH_JAY -C $ROCM_BUILD_DIR" -#ROCM_DKMS_MAKE_OPTS="$DASH_JAY -C $ROCM_DKMS_BUILD_DIR" -#ROCM_DEV_MAKE_OPTS="$DASH_JAY -C $ROCM_DEV_BUILD_DIR" -BUILD_TYPE="Debug" -TARGET="build" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" -ADDRESS_SANITIZER=false -STG2_PKG_BUILD="true" - - -#parse the arguments -VALID_STR=`getopt -o dhcraswo:p: --long help,devstg,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - ADDRESS_SANITIZER=true ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-d | --devstg ) - STG2_PKG_BUILD="false" ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package ) - MAKETARGET=$2 ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -# Generate the pkg list and its versions list as a ";" seperated string and export it to the ENV. -# These PKG_LIST and VER_LIST envs will be used as a LIST in cmake function in utils.cmake -gen_pkg_ver_list() { - - # for mi* and navi* these packages needs to be excluded because of compression problem - # compute-firmware_5.18.0-kfd-compute-rocm-npi-mi*-720_all.deb - # linux-headers-5.18.0-kfd-compute-rocm-npi-mi*-720_5.18.0-kfd-compute-rocm-npi-mi*-720-1_amd64.deb - # linux-image-5.18.0-kfd-compute-rocm-npi-mi*-720_5.18.0-kfd-compute-rocm-npi-mi*-720-1_amd64.deb - # linux-image-6.2.8-kfd-compute-rocm-npi-navi*-wip-41_6.2.8-kfd-compute-rocm-npi-navi*-wip-41-1_amd64.deb - # So making the exclude filelist generic - declare -a Exclfiles=( "compute-firmware_*kfd-compute-rocm-npi-*.deb" - "linux-headers-*kfd-compute-rocm-npi-*.deb" - "linux-image-*kfd-compute-rocm-npi-*.deb" - ) - - #this package needs to be excluded always - Exclfiles+=('*dbgsym*') - - PLIST="" - VLIST="" - search_dir="$PACKAGE_ROOT/$PACKAGEEXT" - - # exclude *dbgsym* pkg files from the search - for file in $(find $search_dir/. -type f -name "*.$PACKAGEEXT" ! -name ${Exclfiles[3]} ! -name ${Exclfiles[0]} ! -name ${Exclfiles[1]} ! -name ${Exclfiles[2]} ); - do - if [ "$PACKAGEEXT" == "deb" ]; then - dpkg -I $file | grep 'Package:\|Version:' > tmpfile - PLIST="$(awk '/Package:/{print $2}' tmpfile);$PLIST" - VLIST="$(awk '/Version:/{print $2}' tmpfile);$VLIST" - - elif [ "$PACKAGEEXT" == "rpm" ]; then - rpm -qip $file | grep 'Name\|Version\|Release' > tmpfile - PLIST="$(awk '/Name/{print $3}' tmpfile);$PLIST" - VLIST="$(awk '/Version/{print $3}' tmpfile)-$(awk '/Release/{print $3}' tmpfile);$VLIST" - - fi - done - - [ -f tmpfile ] && rm tmpfile - - # export as ENV variable - export PKG_LIST="$PLIST" - export VER_LIST="$VLIST" - echo " PKG_LIST=$PKG_LIST" - echo " VER_LIST=$VER_LIST" - -} - -generate_files_from_json() { - #Generate existing pkg list and corresponding version list. - #To be used for meta package dependencies version assignment. - gen_pkg_ver_list - - bash -c 'sudo pip3 install dataclasses' - PY_MODULE="packaging_files_generator.py " - pushd "$ROCM_ROOT/packaging" - - if ! pyret=$(python3 $PY_MODULE ) ; then - echo "FATAL!!! Python exectued with errors..." - echo "Cannot proceed now bailing out .." - exit 3 - fi - - popd - -} - -clean_rocm() { - rm -rf "$ROCM_BUILD_DIR" - rm -rf "$ROCM_PACKAGE_DEB" - rm -rf "$ROCM_PACKAGE_RPM" -} - - -clean_gen_files() { - - GEN_FILES=`find $ROCM_ROOT/ -regextype sed -iregex ".*\.[iu]\{0,\}gen$"` - while IFS= read -r line ; do - if [ ! -z "$line" ]; then - rm "$line" - fi - done <<< "$GEN_FILES" - -} - - -verify_meta_dependencies(){ - - #make package path - pkg_path="$OUT_DIR/$PACKAGEEXT/meta" - PY_MODULE="dependency_tester.py " - #options required by dependency tester - options=" --path=$pkg_path --jd=$JOB_DESIGNATOR --lpv=$ROCM_LIBPATCH_VERSION --bid=$BUILD_ID " - echo " options == $options " - pushd "$ROCM_ROOT/packaging" - - pyret=$(python3 $PY_MODULE $options >> dependency_log.txt 2>&1 ) || true - - echo "========== begin : dependency_log ===========" - cat dependency_log.txt - echo "========== end : dependency_log ===========" - popd - echo " verify_meta_dependencies : over " -} - - -build_rocm() { - echo "Building Meta packaging" - - if [ ! -d "$ROCM_BUILD_DIR" ]; then - mkdir -p "$ROCM_BUILD_DIR" - fi - pushd "$ROCM_BUILD_DIR" - cmake \ - -DCMAKE_VERBOSE_MAKEFILE=1 \ - $(rocm_common_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DCMAKE_INSTALL_PREFIX="$PACKAGE_ROOT" \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - -DROCM_VERSION="$ROCM_VERSION" \ - $ROCM_ROOT - popd - - if [[ "$SHARED_LIBS" == "ON" ]]; then - if [[ "$STG2_PKG_BUILD" == "true" ]]; then - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS pkg_rocm - else - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS STAGE_1_Targets - fi - - # Optional Meta Package - if [[ "$ADDRESS_SANITIZER" == true ]]; then - if [[ "$STG2_PKG_BUILD" == "true" ]]; then - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS pkg_rocm_asan - else - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS ASAN_STAGE_1_Targets - fi - fi - else - # Optional Static Meta Package - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS pkg_rocm_language_static_dev - #stg2 - cmake --build "$ROCM_BUILD_DIR" -- $ROCM_MAKE_OPTS pkg_rocm_static_dev - fi - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$ROCM_PACKAGE_DEB" $ROCM_BUILD_DIR/rocm*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$ROCM_PACKAGE_RPM" $ROCM_BUILD_DIR/rocm*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${ROCM_PACKAGE_DEB};; - ("rpm") - echo ${ROCM_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean_rocm ;; - (build) generate_files_from_json && build_rocm && verify_meta_dependencies ; build_wheel "$ROCM_BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -clean_gen_files - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocm_bandwidth_test.sh b/tools/rocm-build/build_rocm_bandwidth_test.sh deleted file mode 100755 index 1093062e4..000000000 --- a/tools/rocm-build/build_rocm_bandwidth_test.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/bash -x - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -TEST_BIN_DIR="$(getBinPath)" -TEST_NAME="rocm-bandwidth-test" -TEST_UTILS_DIR="$(getUtilsPath)" -TEST_SRC_DIR="rocm_bandwidth_test" -TEST_BLD_DIR="$(getBuildPath $TEST_SRC_DIR)" - -ROCM_PKG_PREFIX="$ROCM_INSTALL_PATH" -TEST_PKG_ROOT="$(getPackageRoot)" -TEST_PKG_DEB="$(getPackageRoot)/deb/$TEST_SRC_DIR" -TEST_PKG_RPM="$(getPackageRoot)/rpm/$TEST_SRC_DIR" - -ROCR_LIB_DIR="$(getPackageRoot)/lib" -ROCR_INC_DIR="$(getPackageRoot)/hsa/include" - -RUN_SCRIPT=$(echo $(basename "${BASH_SOURCE}") | sed "s/build_/run_/") - -TARGET="build" -MAKETARGET="all" -BUILD_TYPE="Debug" -MAKEARG="$DASH_JAY" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" - - -VALID_STR=`getopt -o hcraso:p: --long help,clean,release,static,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; MAKEARG="$MAKEARG REL=1" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; CPACKGEN="${2^^}" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_rocm_bandwidth_test() { - echo "Cleaning $TEST_NAME" - - rm -rf $TEST_BLD_DIR - rm -rf $TEST_PKG_DEB - rm -rf $TEST_PKG_RPM - rm -rf $TEST_BIN_DIR/$TEST_NAME - rm -f $TEST_UTILS_DIR/$RUN_SCRIPT -} - -build_rocm_bandwidth_test() { - - echo "Building $TEST_NAME" - - if [ ! -d "$TEST_BLD_DIR" ]; then - mkdir -p "$TEST_BLD_DIR" - pushd "$TEST_BLD_DIR" - - cmake \ - -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ - -DCMAKE_VERBOSE_MAKEFILE=1 \ - -DCMAKE_INSTALL_PREFIX="$TEST_PKG_ROOT" \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCMAKE_PREFIX_PATH="$ROCM_INSTALL_PATH" \ - $(rocm_common_cmake_params) \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - -DROCM_PATCH_VERSION=$ROCM_LIBPATCH_VERSION \ - -DCMAKE_MODULE_PATH="$ROCM_BANDWIDTH_TEST_ROOT/cmake_modules" \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - "$ROCM_BANDWIDTH_TEST_ROOT" - - popd - fi - - echo "Building $TEST_NAME" - cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR - - echo "Installing $TEST_NAME" - cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR install - - echo "Packaging $TEST_NAME" - cmake --build "$TEST_BLD_DIR" -- $MAKEARG -C $TEST_BLD_DIR package - - mkdir -p "$TEST_BIN_DIR" - echo "Copying $TEST_NAME to $TEST_BIN_DIR" - progressCopy "$TEST_BLD_DIR/$TEST_NAME" "$TEST_BIN_DIR" - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$TEST_PKG_DEB" $TEST_BLD_DIR/*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$TEST_PKG_RPM" $TEST_BLD_DIR/*.rpm - -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${TEST_PKG_DEB};; - ("rpm") - echo ${TEST_PKG_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} -verifyEnvSetup - -case $TARGET in - (clean) clean_rocm_bandwidth_test ;; - (build) build_rocm_bandwidth_test ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocm_smi_lib.sh b/tools/rocm-build/build_rocm_smi_lib.sh deleted file mode 100755 index 30e6395fc..000000000 --- a/tools/rocm-build/build_rocm_smi_lib.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [-c|-r|-32|-h] [makeopts]" - echo - echo "Options:" - echo " -c, --clean Removes all rocm_smi build artifacts" - echo " -r, --release Build non-debug version rocm_smi (default is debug)" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocm-smi. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -p, --package Specify packaging format" - echo " -32, Build 32b version (default is 64b)" - echo " -h, --help Prints this help" - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} -# RSMI ==> deb/rpm package target -# ROCM_SMI ==> rocm_smi library target and header - -# ROCM_SMI -PROJ_NAME="rsmi" -PACKAGE_ROOT="$(getPackageRoot)" -TARGET="build" - -PACKAGE_LIB=$(getLibPath) -PACKAGE_INCLUDE="$(getIncludePath)" - -# RSMI -RSMI_BUILD_DIR=$(getBuildPath rsmi) -RSMI_PACKAGE_DEB_DIR="$(getPackageRoot)/deb/$PROJ_NAME" -RSMI_PACKAGE_RPM_DIR="$(getPackageRoot)/rpm/$PROJ_NAME" -RSMI_BUILD_TYPE="debug" -BUILD_TYPE="Debug" - -# BUILD ARGUMENTS -MAKETARGET="deb" -MAKEARG="$DASH_JAY O=$RSMI_BUILD_DIR" -RSMI_MAKE_OPTS="$DASH_JAY O=$RSMI_BUILD_DIR -C $RSMI_BUILD_DIR" -# The following should be 64 (default) 32 for 32b -ROCM_SMI_BLD_BITS=64 -RSMI_PKG_NAME_ROOT="rocm-smi-lib" -RSMI_PKG_NAME="${RSMI_PKG_NAME_ROOT}${ROCM_SMI_BLD_BITS}" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -PKGTYPE="deb" - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - # TODO - support standard option of passing cmake environment vars - CFLAGS,CXXFLAGS etc., to enable address sanitizer - ADDRESS_SANITIZER=true ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - (-32) - ROCM_SMI_BLD_BITS="32"; shift ;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_rsmi() { - rm -rf "$RSMI_BUILD_DIR" - rm -rf "$RSMI_PACKAGE_DEB_DIR" - rm -rf "$RSMI_PACKAGE_RPM_DIR" - rm -rf "$PACKAGE_ROOT/rocm_smi" - rm -rf "$PACKAGE_INCLUDE/rocm_smi" - rm -f $PACKAGE_LIB/librocm_smi${ROCM_SMI_BLD_BITS}.* - rm -f $PACKAGE_LIB/librocm_smi${ROCM_SMI_BLD_BITS}.* - return 0 -} - -build_rsmi() { - echo "Building RSMI" - echo "RSMI_BUILD_DIR: ${RSMI_BUILD_DIR}" - if [ ! -d "$RSMI_BUILD_DIR" ]; then - mkdir -p $RSMI_BUILD_DIR - pushd $RSMI_BUILD_DIR - print_lib_type $SHARED_LIBS - - cmake \ - -DCMAKE_MODULE_PATH="$ROCM_SMI_LIB_ROOT/cmake_modules" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_common_cmake_params) \ - $(rocm_cmake_params) \ - -DENABLE_LDCONFIG=OFF \ - -DROCM_SMI_PACKAGE="${RSMI_PKG_NAME}" \ - -DCPACK_PACKAGE_VERSION_MAJOR="1" \ - -DCPACK_PACKAGE_VERSION_MINOR="$ROCM_LIBPATCH_VERSION" \ - -DCPACK_PACKAGE_VERSION_PATCH="0" \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DBUILD_TESTS=ON \ - "$ROCM_SMI_LIB_ROOT" - popd - fi - - echo "Making rocm_smi package:" - cmake --build "$RSMI_BUILD_DIR" -- $RSMI_MAKE_OPTS - cmake --build "$RSMI_BUILD_DIR" -- $RSMI_MAKE_OPTS install - cmake --build "$RSMI_BUILD_DIR" -- $RSMI_MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$RSMI_PACKAGE_DEB_DIR" $RSMI_BUILD_DIR/*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$RSMI_PACKAGE_RPM_DIR" $RSMI_BUILD_DIR/*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${RSMI_PACKAGE_DEB_DIR};; - ("rpm") - echo ${RSMI_PACKAGE_RPM_DIR};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean_rsmi ;; - (build) build_rsmi; build_wheel "$RSMI_BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" -exit 0 - diff --git a/tools/rocm-build/build_rocminfo.sh b/tools/rocm-build/build_rocminfo.sh deleted file mode 100755 index cfceb2f16..000000000 --- a/tools/rocm-build/build_rocminfo.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [-c|-r|-h] [makeopts]" - echo - echo "Options:" - echo " -c, --clean Removes all rocminfo build artifacts" - echo " -r, --release Build non-debug version rocminfo (default is debug)" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocminfo. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -PROJ_NAME="rocminfo" -TARGET="build" -ROCMINFO_DEST="$(getBinPath)" -ROCMINFO_SRC_ROOT="$ROCMINFO_ROOT" -ROCMINFO_BUILD_DIR="$(getBuildPath $PROJ_NAME)" - -MAKEARG="$DASH_JAY" -PACKAGE_ROOT="$(getPackageRoot)" -ROCMINFO_PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -ROCMINFO_PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -BUILD_TYPE="debug" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcraswo:g: --long help,clean,release,static,wheel,address_sanitizer,outdir:,gpu_list: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - MAKEARG="$MAKEARG BUILD_TYPE=rel"; BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-g | --gpu_list) - GPU_LIST="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - - -clean_rocminfo() { - echo "Removing rocminfo" - rm -rf $ROCMINFO_DEST/rocminfo - rm -rf $ROCMINFO_BUILD_DIR - rm -rf $ROCMINFO_PACKAGE_DEB - rm -rf $ROCMINFO_PACKAGE_RPM -} - -build_rocminfo() { - if [ ! -d "$ROCMINFO_BUILD_DIR" ]; then - mkdir -p $ROCMINFO_BUILD_DIR - pushd $ROCMINFO_BUILD_DIR - - cmake \ - $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DROCRTST_BLD_TYPE="$BUILD_TYPE" \ - $(rocm_common_cmake_params) \ - -DCPACK_PACKAGE_VERSION_MAJOR="1" \ - -DCPACK_PACKAGE_VERSION_MINOR="$ROCM_LIBPATCH_VERSION" \ - -DCPACK_PACKAGE_VERSION_PATCH="0" \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE\ - $ROCMINFO_SRC_ROOT - - echo "Making rocminfo:" - cmake --build . -- $MAKEARG - cmake --build . -- $MAKEARG install - cmake --build . -- $MAKEARG package - popd - fi - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$ROCMINFO_PACKAGE_DEB" $ROCMINFO_BUILD_DIR/*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$ROCMINFO_PACKAGE_RPM" $ROCMINFO_BUILD_DIR/*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${ROCMINFO_PACKAGE_DEB};; - ("rpm") - echo ${ROCMINFO_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -case $TARGET in - (clean) clean_rocminfo ;; - (build) build_rocminfo; build_wheel "$ROCMINFO_BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" -exit 0 diff --git a/tools/rocm-build/build_rocmvalidationsuite.sh b/tools/rocm-build/build_rocmvalidationsuite.sh deleted file mode 100755 index 6a717a689..000000000 --- a/tools/rocm-build/build_rocmvalidationsuite.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src ROCmValidationSuite - -# Internal RVS libraries need the extra RPATH -ROCM_RVS_LIB_RPATH="\$ORIGIN/.." - -build_rocmvalidationsuite() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - CXX=$(set_build_variables __CXX__) - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - cd "${COMPONENT_SRC}" - mkdir -p "$BUILD_DIR" - init_rocm_common_cmake_params - # rocm_common_cmake_params provides the default rpath for rocm executables and libraries - # Override cmake shared linker flags, since rvs libraries requires RUNPATH - $ORIGIN:$ORIGIN/.. - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - -DFETCH_ROCMPATH_FROM_ROCMCORE=ON \ - -DCMAKE_SHARED_LINKER_FLAGS_INIT="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LIB_RPATH:$ROCM_RVS_LIB_RPATH" \ - -B "$BUILD_DIR" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - mkdir -p "${PACKAGE_DIR}" && cp "${BUILD_DIR}"/*."${PKGTYPE}" "${PACKAGE_DIR}" - - show_build_cache_stats -} - -clean_rocmvalidationsuite() { - echo "Cleaning ROCmValidationSuite build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "${BUILD_DIR}" "${PACKAGE_DIR}" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocmvalidationsuite; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocmvalidationsuite ;; - *) die "Invalid target ${TARGET}" ;; -esac diff --git a/tools/rocm-build/build_rocprim.sh b/tools/rocm-build/build_rocprim.sh deleted file mode 100755 index d0a9f7f7d..000000000 --- a/tools/rocm-build/build_rocprim.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocPRIM - -build_rocprim() { - echo "Start build" - - cd $COMPONENT_SRC - # Temporary Fix as suggested in #SWDEV-314510 - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - #Set ASAN flags - set_asan_env_vars - set_address_sanitizer_on - # ASAN packaging is not required for rocPRIM, since its header only package - # Setting the asan_cmake_params to false will disable ASAN packaging - ASAN_CMAKE_PARAMS="false" - fi - - # Enable/Disable Static Flag to be used for - # Package Dependecies during static/non-static builds - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - #Removed GPU ARCHS from here as it will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - - init_rocm_common_cmake_params - CXX=$(set_build_variables __HIP_CC__) \ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_BENCHMARK=OFF \ - -DBUILD_TEST=ON \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocprim() { - echo "Cleaning rocPRIM build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocprim; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocprim ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocprofiler-compute.sh b/tools/rocm-build/build_rocprofiler-compute.sh deleted file mode 100755 index 6bfa7545b..000000000 --- a/tools/rocm-build/build_rocprofiler-compute.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -h, --help Prints this help" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of ROCm Compute Profiler. - It needs to be used along with -r option" - echo - echo "Possible values for package :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="rocprofiler-compute" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$API_NAME" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - -#parse the arguments -VALID_STR=$(getopt -o hcraso:p:w --long help,clean,release,static,address_sanitizer,outdir:,package:,wheel -- "$@") -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage ; exit 0;; - -a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - -c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - -o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - -p | --package) - MAKETARGET="$2" ; shift 2 ;; - -r | --release) - BUILD_TYPE="Release" ; shift ;; - -s | --static) - ack_and_skip_static ;; - -w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - --) shift; break;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options "$CLEAN_OR_OUT" "$PKGTYPE" "$MAKETARGET" -if [ $RET_CONFLICT -ge 30 ]; then - print_vars "$API_NAME" "$TARGET" "$BUILD_TYPE" "$SHARED_LIBS" "$CLEAN_OR_OUT" "$PKGTYPE" "$MAKETARGET" - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME:?}" - rm -rf "$PACKAGE_LIB/${LIB_NAME:?}"* -} - -build() { - echo "Building $PROJ_NAME" - if [ "$DISTRO_ID" = centos-7 ]; then - echo "Skip make and uploading packages for ROCm Compute Profiler on Centos7 distro, due to python dependency" - exit 0 - fi - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" || exit - - echo "ROCm CMake Params: $(rocm_cmake_params)" - echo "ROCm Common CMake Params: $(rocm_common_cmake_params)" - - #install python deps - #python3 -m pip install -t ${BUILD_DIR}/python-libs -r ${ROCPROFILER_COMPUTE_ROOT}/requirements.txt - print_lib_type $SHARED_LIBS - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - ${GEN_NINJA} \ - -DCHECK_PYTHON_DEPS=NO \ - -DPYTHON_DEPS=${BUILD_DIR}/python-libs \ - -S "$ROCPROFILER_COMPUTE_ROOT" - fi - ninja $MAKE_OPTS - ninja $MAKE_OPTS install - ninja $MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo "${PACKAGE_DEB}";; - ("rpm") - echo "${PACKAGE_RPM}";; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocprofiler-register.sh b/tools/rocm-build/build_rocprofiler-register.sh deleted file mode 100755 index 7d99f7721..000000000 --- a/tools/rocm-build/build_rocprofiler-register.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -w, --wheel Creates python wheel package of rocprofiler-register. It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="rocprofiler-register" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$API_NAME" -PACKAGE_PREFIX="$ROCM_INSTALL_PATH" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,address_sanitizer,wheeloutdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="Release" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME}" - rm -rf "$PACKAGE_LIB/${LIB_NAME}"* -} - -build() { - echo "Building $PROJ_NAME" - - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - print_lib_type $SHARED_LIBS - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DENABLE_LDCONFIG=OFF \ - -DROCPROFILER_REGISTER_BUILD_CI=1 \ - -DROCPROFILER_REGISTER_BUILD_TESTS=1 \ - -DROCPROFILER_REGISTER_BUILD_SAMPLES=1 \ - "$ROCPROFILER_REGISTER_ROOT" - popd - fi - cmake --build "$BUILD_DIR" -- $MAKE_OPTS - cmake --build "$BUILD_DIR" -- $MAKE_OPTS install - cmake --build "$BUILD_DIR" -- $MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocprofiler-sdk.sh b/tools/rocm-build/build_rocprofiler-sdk.sh deleted file mode 100755 index 8e30895de..000000000 --- a/tools/rocm-build/build_rocprofiler-sdk.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -w, --wheel Creates python wheel package of rocprofiler-sdk. - It needs to be used along with -r option" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="rocprofiler-sdk" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -PACKAGE_PREFIX="$ROCM_INSTALL_PATH" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" -# Handling GPU Targets for HSACO and HIP Executables -GPU_LIST="gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx1030;gfx1031;gfx1100;gfx1101;gfx1102" -ASAN=0 - -#parse the arguments -VALID_STR=$(getopt -o hcrawso:p: --long help,clean,release,static,address_sanitizer,wheel,outdir:,package: -- "$@") -eval set -- "$VALID_STR" - -while true; do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="RelWithDebInfo" - shift - ;; - -a | --address_sanitizer) - set_address_sanitizer_on - set_asan_env_vars - ASAN=1 - shift - ;; - -s | --static) - ack_and_skip_static - ;; - -w | --wheel) - WHEEL_PACKAGE=true - shift - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - -p | --package) - MAKETARGET="$2" - shift 2 - ;; - --) - shift - break - ;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME}" - rm -rf "$PACKAGE_ROOT/libexec/${PROJ_NAME}" - rm -rf "$PACKAGE_INCLUDE/${PROJ_NAME}" - rm -rf "$PACKAGE_LIB/${LIB_NAME}"* - rm -rf "$PACKAGE_LIB/${PROJ_NAME}" -} - -build_rocprofiler-sdk() { - if [ ! -f "${ROCPROFILER_SDK_ROOT}/CMakeLists.txt" ]; then - echo "Warning: $ROCPROFILER_SDK_ROOT not found" - else - echo "Building $PROJ_NAME" - PACKAGE_CMAKE="$(getCmakePath)" - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - print_lib_type $SHARED_LIBS - - if [ $ASAN == 1 ]; then - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DAMDDeviceLibs_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/AMDDeviceLibs" \ - -Dhip_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip" \ - -Dhip-lang_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip-lang" \ - -Damd_comgr_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/amd_comgr" \ - -Dhsa-runtime64_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsa-runtime64" \ - -Dhsakmt_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsakmt" \ - -DCMAKE_HIP_COMPILER_ROCM_ROOT="${ROCM_INSTALL_PATH}" \ - -DCMAKE_PREFIX_PATH="${ROCM_INSTALL_PATH};${ROCM_INSTALL_PATH}/lib/asan" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DGPU_TARGETS="$GPU_LIST" \ - -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=OFF \ - -DPython3_EXECUTABLE=$(which python3) \ - "$ROCPROFILER_SDK_ROOT" - else - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DCMAKE_PREFIX_PATH="${ROCM_INSTALL_PATH}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DGPU_TARGETS="$GPU_LIST" \ - -DROCPROFILER_BUILD_SAMPLES=ON \ - -DROCPROFILER_BUILD_TESTS=ON \ - -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=OFF \ - -DPython3_EXECUTABLE=$(which python3) \ - "$ROCPROFILER_SDK_ROOT" - fi - - popd - fi - cmake --build "$BUILD_DIR" --target all -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target install -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target package -- $MAKE_OPTS - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm - fi -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo ${PACKAGE_DEB} - ;; - "rpm") - echo ${PACKAGE_RPM} - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - clean) clean ;; - build) build_rocprofiler-sdk; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - outdir) print_output_directory ;; - *) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocprofiler-systems.sh b/tools/rocm-build/build_rocprofiler-systems.sh deleted file mode 100755 index 1f7fb9815..000000000 --- a/tools/rocm-build/build_rocprofiler-systems.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -w, --wheel Creates python wheel package of rocprof_sys. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="rocprofiler-systems" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -# PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$(getPackageRoot)/deb/$API_NAME" -PACKAGE_RPM="$(getPackageRoot)/rpm/$API_NAME" -# PACKAGE_PREFIX="$ROCM_INSTALL_PATH" -BUILD_TYPE="Debug" -MAKE_OPTS="-j 8" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" -ASAN=0 - -#parse the arguments -VALID_STR=$(getopt -o hcraso:p:w --long help,clean,release,address_sanitizer,static,outdir:,package:,wheel -- "$@") -eval set -- "$VALID_STR" - -while true; do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="RelWithDebInfo" - shift - ;; - -a | --address_sanitizer) - ack_and_ignore_asan - # set_asan_env_vars - # set_address_sanitizer_on - - ASAN=1 - shift - ;; - -s | --static) - ack_and_skip_static - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - # OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - -p | --package) - MAKETARGET="$2" - shift 2 - ;; - -w | --wheel) - WHEEL_PACKAGE=true - shift - ;; - --) - shift - break - ;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME:?}" - rm -rf "$PACKAGE_LIB/${LIB_NAME:?}"* -} - -build_rocprofiler_systems() { - echo "Building $PROJ_NAME" - if [ "$DISTRO_ID" = "mariner-2.0" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ]; then - echo "Skip make and uploading packages for \"$PROJ_NAME\" on \"${DISTRO_ID}\" distro" - exit 0 - fi - - if [ $ASAN == 1 ]; then - echo "Skip make and uploading packages for rocprofiler-systems on ASAN build" - exit 0 - fi - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - echo "Created build directory: $BUILD_DIR" - fi - - cd $ROCPROFILER_SYSTEMS_ROOT || exit - - echo "Current submodule status" - git submodule status - echo "Cached (old) submodule status" - git submodule status --cached - cat .git/config - - echo "Updating submodules" - git submodule init - # copy the new URL to your local config - git submodule sync --recursive - # force update the submodule from the new URL - git submodule update --init --recursive --force - - echo "Updated submodule status" - git submodule status - cat .git/config - - echo "Build directory: $BUILD_DIR" - pushd "$BUILD_DIR" || exit - print_lib_type $SHARED_LIBS - - ELFUTIL_URL="https://compute-artifactory.amd.com/artifactory/rocm-generic-local/dev-tools/omnitrace/elfutils-0.188.tar.bz2" - BINUTIL_URL="https://compute-artifactory.amd.com/artifactory/rocm-generic-local/dev-tools/omnitrace/binutils-2.40.tar.gz" - - echo "ROCm CMake Params: $(rocm_cmake_params)" - echo "ROCm Common CMake Params: $(rocm_common_cmake_params)" - echo "ELFUTIL_URL=$ELFUTIL_URL, BINUTIL_URL=$BINUTIL_URL" - - if [ $ASAN == 1 ]; then - echo "Address Sanitizer path" - - # Commenting out the below cmake command as it is not working as expected - # LD_LIBRARY_PATH=$ROCM_INSTALL_PATH/lib/asan:$LD_LIBRARY_PATH - # cmake \ - # $(rocm_cmake_params) \ - # $(rocm_common_cmake_params) \ - # -DROCPROFSYS_BUILD_{LIBUNWIND,DYNINST}=ON \ - # -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON \ - # -DAMDDeviceLibs_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/AMDDeviceLibs" \ - # -Dhip_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip" \ - # -Dhip-lang_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hip-lang" \ - # -Damd_comgr_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/amd_comgr" \ - # -Dhsa-runtime64_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsa-runtime64" \ - # -Dhsakmt_DIR="${ROCM_INSTALL_PATH}/lib/asan/cmake/hsakmt" \ - # -DROCM_PATH="${ROCM_INSTALL_PATH}/lib/asan" \ - # -Drocprofiler_ROOT_DIR="${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCMAKE_HIP_COMPILER_ROCM_ROOT="${ROCM_INSTALL_PATH}" \ - # -DCMAKE_PREFIX_PATH="${ROCM_INSTALL_PATH};${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCMAKE_LIBRARY_PATH="${ROCM_INSTALL_PATH}/lib/asan" \ - # -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=OFF \ - # "$ROCPROFILER_SYSTEMS_ROOT" - - else - cmake \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DROCPROFSYS_BUILD_{LIBUNWIND,DYNINST}=ON \ - -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON \ - -DElfUtils_DOWNLOAD_URL="$ELFUTIL_URL" \ - -D{DYNINST,TIMEMORY}_BINUTILS_DOWNLOAD_URL="$BINUTIL_URL" \ - "$ROCPROFILER_SYSTEMS_ROOT" - fi - - - popd || exit - - echo "Make Options: $MAKE_OPTS" - cmake --build "$BUILD_DIR" --target all -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target install -- $MAKE_OPTS - cmake --build "$BUILD_DIR" --target package -- $MAKE_OPTS - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo "${PACKAGE_DEB}" - ;; - "rpm") - echo "${PACKAGE_RPM}" - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in - clean) clean ;; - build) build_rocprofiler_systems; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - outdir) print_output_directory ;; - *) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocprofiler.sh b/tools/rocm-build/build_rocprofiler.sh deleted file mode 100755 index 7ea7c91b4..000000000 --- a/tools/rocm-build/build_rocprofiler.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -w, --wheel Creates python wheel package of roc-profiler. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME="rocprofiler" -PROJ_NAME="$API_NAME" -LIB_NAME="lib${API_NAME}" -TARGET="build" -MAKETARGET="deb" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_LIB="$(getLibPath)" -PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -PACKAGE_PREFIX="$ROCM_INSTALL_PATH" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" -# Handling GPU Targets for HSACO and HIP Executables -GPU_LIST="gfx900,gfx906,gfx908,gfx90a,gfx940,gfx941,gfx942,gfx1030,gfx1031,gfx1100,gfx1101,gfx1102,gfx1200,gfx1201" - -#parse the arguments -VALID_STR=$(getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@") -eval set -- "$VALID_STR" - -while true; do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="RelWithDebInfo" - shift - ;; - -a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - shift - ;; - -s | --static) - ack_and_skip_static - ;; - -w | --wheel) - WHEEL_PACKAGE=true - shift - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - -p | --package) - MAKETARGET="$2" - shift 2 - ;; - --) - shift - break - ;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME}" - rm -rf "$PACKAGE_ROOT/libexec/${PROJ_NAME}" - rm -rf "$PACKAGE_INCLUDE/${PROJ_NAME}" - rm -rf "$PACKAGE_LIB/${LIB_NAME}"* - rm -rf "$PACKAGE_LIB/${PROJ_NAME}" -} - -build_rocprofiler() { - echo "Building $PROJ_NAME" - PACKAGE_CMAKE="$(getCmakePath)" - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - print_lib_type $SHARED_LIBS - - cmake \ - $(rocm_cmake_params) \ - -DCMAKE_MODULE_PATH="$ROCPROFILER_ROOT/cmake_modules;$PACKAGE_CMAKE/hip" \ - $(rocm_common_cmake_params) \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DENABLE_LDCONFIG=OFF \ - -DUSE_PROF_API=1 \ - -DUSE_GET_ROCM_PATH_API=1 \ - -DGPU_TARGETS="$GPU_LIST" \ - -DPython3_EXECUTABLE=$(which python3) \ - -DPROF_API_HEADER_PATH="$WORK_ROOT/roctracer/inc/ext" \ - -DHIP_HIPCC_FLAGS=$HIP_HIPCC_FLAGS";--offload-arch=$GPU_LIST" \ - -DCPACK_OBJCOPY_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-objcopy" \ - -DCPACK_READELF_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-readelf" \ - -DCPACK_STRIP_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-strip" \ - -DCPACK_OBJDUMP_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-objdump" \ - "$ROCPROFILER_ROOT" - - popd - fi - cmake --build "$BUILD_DIR" -- $MAKE_OPTS - cmake --build "$BUILD_DIR" -- $MAKE_OPTS mytest - cmake --build "$BUILD_DIR" -- $MAKE_OPTS install - cmake --build "$BUILD_DIR" -- $MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo ${PACKAGE_DEB} - ;; - "rpm") - echo ${PACKAGE_RPM} - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} - -verifyEnvSetup - -case "$TARGET" in -clean) clean ;; -build) build_rocprofiler; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; -outdir) print_output_directory ;; -*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocr.sh b/tools/rocm-build/build_rocr.sh deleted file mode 100755 index 69733c65c..000000000 --- a/tools/rocm-build/build_rocr.sh +++ /dev/null @@ -1,380 +0,0 @@ -#!/bin/bash - -# Build thunk, rocr runtime, rocrtst, and kfdtest. -# This replaces the build scripts for those components. - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" -PROJ_NAME="rocr" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...] [make options]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo " -n, --norocr Don't build ROCr runtime (default is to build). This implies --norocrtst." - echo " -k, --nokfdtest Don't build kfdtest (default is to build)" - echo " -w, --wheel Creates python wheel packages. It needs to be used along with -r option" - echo " -t, --norocrtst Don't build rocrtst (default is to build)" - echo "" - echo " rocrtst options:" - echo " -e, --emulator Build a version suitable for running on emulator" - echo " -g, --gpu_list Quoted, semi-colon separated list of gpu architectures that" - echo " kernels will run on; e.g., \"gfx803;gfx900;...\" the" - echo " default is to build kernels for all supported architectures." - - echo - echo "Default build: debug, shared libs" - - return 0 -} - -build_rocr_runtime() { - echo "Build ROCr Runtime" - echo "$ROCR_ROOT" - - # Set pkg config path for Static builds - # so that static libraries of drm and libdrm_amdgpu will get linked - if [ "$shared_libs" == "OFF" ]; then - install_drmStatic_lib - fi - - if [ ! -d "$rocr_build_dir" ]; then - mkdir -p "$rocr_build_dir" - pushd "$rocr_build_dir" || { echo "Failed to pushd into $rocr_build_dir"; exit 1; } - print_lib_type "$shared_libs" - - cmake \ - $(rocm_cmake_params) \ - -DBUILD_SHARED_LIBS="$shared_libs" \ - -DBUILD_ROCR="$rocr_target" \ - -DENABLE_LDCONFIG=OFF \ - $(rocm_common_cmake_params) \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DROCM_INSTALL_PATH="$ROCM_INSTALL_PATH" \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - -DTHUNK_DEFINITIONS="$thunk_defines_string" \ - -DROCR_DEFINITIONS="$rocr_defines_string" \ - "$ROCR_ROOT" - popd - fi - - cmake --build "$rocr_build_dir" --verbose -- $DASH_JAY - cmake --build "$rocr_build_dir" --target install --verbose - cmake --build "$rocr_build_dir" --target package --verbose - mkdir -p "$package_lib" - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$package_root_deb" "$rocr_build_dir"/hsa-rocr*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$package_root_rpm" "$rocr_build_dir"/hsa-rocr*.rpm -} - -build_rocrtst() { - rocrtst_build_type="debug" - mkdir -p "$rocrtst_build_dir" - pushd "$rocrtst_build_dir" || { echo "Failed to pushd into $rocrtst_build_dir"; exit 1; } - # BUILD_TYPE set to RelWithDebInfo causes rocm_common_cmake_params - # to set some CPACK_RPM and _DEBIAN variables to be set which causes - # problems for rocrtst at the packaging stage. Leave unset for now. - BUILD_TYPE= - if [[ $gpu_list ]]; then - cmake -DTARGET_DEVICES="$gpu_list" \ - -DROCRTST_BLD_TYPE="$rocrtst_build_type" \ - -DBUILD_SHARED_LIBS="$shared_libs" \ - -DCMAKE_PREFIX_PATH="$ROCM_INSTALL_PATH;$ROCM_INSTALL_PATH/llvm" \ - -DCMAKE_VERBOSE_MAKEFILE=1 \ - $(rocm_common_cmake_params) \ - -DCMAKE_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - -DROCM_PATCH_VERSION="$ROCM_LIBPATCH_VERSION" \ - -DROCM_DIR="$ROCM_INSTALL_PATH" \ - -DLLVM_DIR="$ROCM_INSTALL_PATH/llvm/bin" \ - -DOPENCL_DIR="$ROCM_INSTALL_PATH" \ - -DEMULATOR_BUILD="$emulator_build" \ - "$rocrtst_src_root" - else - cmake -DROCRTST_BLD_TYPE="$rocrtst_build_type" \ - -DCMAKE_VERBOSE_MAKEFILE=1 \ - -DBUILD_SHARED_LIBS="$shared_libs" \ - -DCMAKE_PREFIX_PATH="$ROCM_INSTALL_PATH;$ROCM_INSTALL_PATH/llvm" \ - -DCMAKE_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - $(rocm_common_cmake_params) \ - -DROCM_PATCH_VERSION="$ROCM_LIBPATCH_VERSION" \ - -DROCM_DIR="$ROCM_INSTALL_PATH" \ - -DLLVM_DIR="$ROCM_INSTALL_PATH/llvm/bin" \ - -DOPENCL_DIR="$ROCM_INSTALL_PATH" \ - -DEMULATOR_BUILD="$emulator_build" \ - "$rocrtst_src_root" - fi - echo "Making rocrtst:" - echo "MAKEARG=$MAKEARG [eom]" - - cmake --build . -- $DASH_JAY - cmake --build . -- rocrtst_kernels - # Packaging is not required, so || true - cmake --build . -- package || true - mkdir -p "$rocrtst_package" - - echo "Copying rocrtst binaries to $rocrtst_package" - progressCopy "$rocrtst_build_dir" "$rocrtst_package" - progressCopy "$ROCRTST_ROOT/thirdparty" "$rocrtst_package/thirdparty" || true - - DEB_FILE=(./rocrtst*.deb) - if [ -e "${DEB_FILE[0]}" ]; then - mkdir -p "$package_root_deb" - progressCopy "${DEB_FILE[@]}" "$package_root_deb" - fi - - RPM_FILE=(./rocrtst*.rpm) - if [ -e "${RPM_FILE[0]}" ]; then - mkdir -p "$package_root_rpm" - progressCopy "${RPM_FILE[@]}" "$package_root_rpm" - fi - popd - -} - -# first define a function so I can use "set --" to overwrite the positional args. -# Not needed in this case, but better to be safe... -# Needed for wildcard globbing since we make 2 kfdtest RPMs now -file_exists(){ - set -- $1 - [ -e "$1" ] -} - -build_kfdtest() { - echo "Building kfdtest" - - mkdir -p "$kfdtest_build_dir" - pushd "$kfdtest_build_dir" || { echo "Failed to pushd into $kfdtest_build_dir"; exit 1; } - - # LDFLAGS will be set only for address sanitizer build - cmake \ - -DCMAKE_BUILD_TYPE="$build_type" \ - -DBUILD_SHARED_LIBS="$shared_libs" \ - -DCMAKE_PREFIX_PATH="${ROCM_INSTALL_PATH}" \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$ROCM_INSTALL_PATH" \ - $(rocm_common_cmake_params) \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - -DCMAKE_INSTALL_RPATH_USE_LINK_PATH="FALSE" \ - -DCPACK_GENERATOR="${CPACKGEN:-"DEB;RPM"}" \ - -DCPACK_RPM_DEBUGINFO_PACKAGE=YES \ - -DCPACK_RPM_PACKAGE_DEBUG=YES \ - -DCMAKE_SKIP_BUILD_RPATH=TRUE \ - -DCMAKE_EXE_LINKER_FLAGS="-Wl,--enable-new-dtags -Wl,--rpath,$ROCM_RPATH $LDFLAGS" \ - "$kfdtest_src_root" - cmake --build . -- $DASH_JAY - # Putting || true to ensure backwards compatibility for branches - # without the CPACK change to KFDTest - cmake --build . -- package || true - popd - - mkdir -p "$kfdtest_bin" - progressCopy "$kfdtest_build_dir" "$kfdtest_bin" - progressCopy "$kfdtest_build_dir/kfdtest.exclude" "$kfdtest_bin" - - if file_exists $kfdtest_build_dir/kfdtest*.deb ; then - mkdir -p "$package_root_deb" - cp "$kfdtest_build_dir"/kfdtest*.deb "$package_root_deb" - fi - - if file_exists "$kfdtest_build_dir"/kfdtest*.rpm ; then - mkdir -p "$package_root_rpm" - cp $kfdtest_build_dir/kfdtest*.rpm "$package_root_rpm" - fi -} - -clean_rocr_runtime() { - echo "Cleaning ROCr Runtime" - # clean libhsakmt - rm -f $package_lib/libhsakmt.so* - rm -f $package_lib/libhsakmt.a - rm -f $package_lib/libhsakmt-staticdrm.a - rm -f $package_include/hsakmt*.h $package_include/linux/kfd_ioctl.h - - # clean rocr - rm -rf "${runtime_build_dir}" - rm -f "$package_root"/lib/libhsa-runtime* - rm -rf "$package_root/lib/cmake/hsa-runtime64" - rm -rf "$package_root/include/hsa" - rm -rf "$package_root/share/doc/hsa-runtime64" - rm -f "$package_root_deb"/hsa-rocr*.deb - rm -f "$package_root_rpm"/hsa-rocr*.rpm - rm -f "$package_root_rpm"/hsa_rocr*.whl - - # Remove when switching to flat directory layout. - rm -rf "$PACKAGE_ROOT/hsa" - - clean_rocrtst - clean_kfdtest -} - -clean_rocrtst() { - echo "Cleaning rocrtst" - rm -rf "${rocrtst_package}" - rm -rf "${rocrtst_build_dir}" - rm -rf "${package_root_deb}"/rocrtst*.deb - rm -rf "${package_root_rpm}"/rocrtst*.rpm -} - -clean_kfdtest() { - echo "Cleaning kfdtest" - rm -rf "$kfdtest_build_dir" - rm -rf "$kfdtest_bin" - rm -rf "$package_root_deb"/kfdtest*.deb - rm -rf "$package_root_rpm"/kfdtest*.rpm -} - -print_output_directory() { - case ${pkgtype} in - ("deb") - echo "${package_root_deb}";; - ("rpm") - package_rpm="some_value" - echo "${package_root_rpm}";; - (*) - echo "Invalid package type \"${pkgtype}\" provided for -o" >&2; exit 1;; - esac - exit -} - -# Common variables -target="build" - -kfdtest_target="yes" -rocrtst_target="yes" -rocr_target="ON" - -package_root="$(getPackageRoot)" -package_root_deb="${package_root}/deb/$PROJ_NAME" -package_root_rpm="${package_root}/rpm/$PROJ_NAME" - -# NOT NEEDED? PACKAGE_SRC="$(getSrcPath)" -package_lib="$(getLibPath)" -# package_bin="$(getBinPath)" -package_include="$(getIncludePath)" -runtime_build_dir="$(getBuildPath runtime)" - -# ROCR_DEV_BUILD_DIR="$(getBuildPath hsa-rocr-dev)" -# PREFIX_PATH="$package_root" -BUILD_TYPE="Debug" -shared_libs="ON" -clean_or_out=0; -maketarget="deb" -pkgtype="deb" - -# ROCt variables -thunk_defines_string= -roct_build_dir="${runtime_build_dir}/libhsakmt" - -# ROCr variables -rocr_defines_string= -rocr_build_dir="${runtime_build_dir}/$PROJ_NAME" - -# rocrtst variables -rocrtst_package="$(getBinPath)/rocrtst_tests" -rocrtst_build_dir="${runtime_build_dir}/rocrtst" -rocrtst_src_root="$ROCRTST_ROOT/suites/test_common" -emulator_build=0 - -# kfdtest variables -# kfdtest_defines_string= -kfdtest_src_root="$ROCR_ROOT/libhsakmt/tests/kfdtest" -kfdtest_bin="$(getBinPath)/kfdtest" -package_utils="$(getUtilsPath)" -# May need to handle putting different components in different build directories (below) -kfdtest_build_dir=${runtime_build_dir}/kfdtest - -unset HIP_DEVICE_LIB_PATH -unset ROCM_PATH - -#parse the arguments -valid_str=$(getopt -o hcraswnkteg:o: --long help,clean,release,static,wheel,address_sanitizer,norocr,nokfdtest,norocrtst,emulator,gpu_list:,outdir: -- "$@") -eval set -- "$valid_str" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - target="clean" ; ((clean_or_out|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - shared_libs="OFF" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-n | --norocr) - rocr_target="OFF" - rocrtst_target="no"; shift ;; - (-k | --nokfdtest) - kfdtest_target="no" ; shift ;; - (-t | --norocrtst) - rocrtst_target="no" ; shift ;; - (-e | --emulator ) - emulator_build=1 ; shift ;; - (-g | --gpu_list ) - gpu_list=$2 ; shift 2;; - (-o | --outdir) - target="outdir"; pkgtype=$2 ; OUT_DIR_SPECIFIED=1 ; ((clean_or_out|=2)) ; shift 2 ;; - --) shift; break;; # end delimiter - (*) - echo " ${BASH_SOURCE}: UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 22;; - esac -done - -ret_conflict=1 -check_conflicting_options $clean_or_out $pkgtype $maketarget -if [ $ret_conflict -ge 30 ]; then - print_vars $API_NAME $target $BUILD_TYPE $shared_libs $clean_or_out $pkgtype $maketarget - exit $ret_conflict -fi - -case $target in - (clean) clean_rocr_runtime ;; - (build) build_rocr_runtime;; - (outdir) print_output_directory ;; - (*) die "Invalid target $target" ;; -esac - -checkchild(){ - if wait "$1"; then - return; - else - die "$2 failed with exit code $?" - fi -} -# Run the build for rocrtst and kfdtest in parallel -if [ "$target" != "clean" ]; then - if [ "$rocrtst_target" == "yes" ]; then - build_rocrtst & - else - true & # Dummy build_rocrtst - fi - rocrtst_pid=$! - if [ "$kfdtest_target" == "yes" ]; then - build_kfdtest & - else - true & # Dummy build_kfdtest - fi - kfdtest_pid=$! - checkchild $kfdtest_pid kfdtest - checkchild $rocrtst_pid rocrtst -fi -# build wheel package -if [[ "$target" == "build" ]]; then - build_wheel "$rocr_build_dir" "$PROJ_NAME" -fi - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocr_debug_agent.sh b/tools/rocm-build/build_rocr_debug_agent.sh deleted file mode 100755 index 744e192a8..000000000 --- a/tools/rocm-build/build_rocr_debug_agent.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -w, --wheel Creates python wheel package of rocr-debug-agent. - It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -h, --help Prints this help" - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Build environment variables -API_NAME=rocm-debug-agent -PROJ_NAME=$API_NAME -LIB_NAME=lib${API_NAME}.so -TARGET=build -MAKETARGET=deb -PACKAGE_ROOT=$(getPackageRoot) -PACKAGE_BIN="$(getBinPath)" -PACKAGE_LIB=$(getLibPath) -PACKAGE_INCLUDE=$(getIncludePath) -BUILD_DIR=$(getBuildPath $API_NAME) -PACKAGE_DEB=$PACKAGE_ROOT/deb/$PROJ_NAME -PACKAGE_RPM=$PACKAGE_ROOT/rpm/$PROJ_NAME -PACKAGE_PREFIX=$ROCM_INSTALL_PATH -BUILD_TYPE=Debug -MAKE_OPTS="$DASH_JAY -C" - -## Test variables -TEST_PACKAGE_DIR="$(getBinPath)/rocm-debug-agent-test" -PACKAGE_UTILS=$(getUtilsPath) - -BC_DIR="$PACKAGE_ROOT/lib/bitcode" -if [ -d "$BC_DIR" ] ; then - export DEVICE_LIB_PATH=$BC_DIR -fi - - -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,static,wheel,address_sanitizer,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf $BUILD_DIR - rm -rf $TEST_PACKAGE_DIR - rm -rf $PACKAGE_DEB - rm -rf $PACKAGE_RPM - rm -rf $PACKAGE_ROOT/${PROJ_NAME} - rm -rf $PACKAGE_LIB/${LIB_NAME}* - rm -f $PACKAGE_UTILS/run_rocr_debug_agent_test.sh -} - -build() { - echo "Building $PROJ_NAME" - # The cmake path is different for asan and non-asan builds. - # Fetch after getting build type. Default will be non-asan build - PACKAGE_CMAKE="$(getCmakePath)" - # If rocm is installed to an unconventional location, --rocm-path needs to be set. - export HIPCC_COMPILE_FLAGS_APPEND="--rocm-path=$ROCM_PATH" - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - - cmake $(rocm_cmake_params) \ - -DCMAKE_PREFIX_PATH="$PACKAGE_CMAKE/amd-dbgapi" \ - -DCMAKE_MODULE_PATH="$PACKAGE_CMAKE/hip" \ - $(rocm_common_cmake_params) \ - -DCMAKE_HIP_ARCHITECTURES=OFF \ - $ROCR_DEBUG_AGENT_ROOT - - popd - fi - cmake --build "$BUILD_DIR" -- $MAKE_OPTS $BUILD_DIR - cmake --build "$BUILD_DIR" -- $MAKE_OPTS $BUILD_DIR install - cmake --build "$BUILD_DIR" -- $MAKE_OPTS $BUILD_DIR package - - mkdir -p $PACKAGE_LIB - cp -R $BUILD_DIR/${LIB_NAME}* $PACKAGE_LIB - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DEB}" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_RPM}" "$BUILD_DIR/${API_NAME}"*.rpm - - ## Copy run test py script - echo "copying run-test.py to $PACKAGE_BIN" - progressCopy "$ROCR_DEBUG_AGENT_ROOT/test/run-test.py" "$PACKAGE_BIN" -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${PACKAGE_DEB};; - ("rpm") - echo ${PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean ;; - (build) build; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $target" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocrand.sh b/tools/rocm-build/build_rocrand.sh deleted file mode 100755 index 287d2c873..000000000 --- a/tools/rocm-build/build_rocrand.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocRAND - -build_rocrand() { - echo "Start build" - - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - #Removed GPU ARCHS from here as it will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # updating GPU_ARCHS for ASAN build to supported gpu arch only SWDEV-479178 - #GPU_ARCHS="gfx90a:xnack+;gfx942:xnack+"#This will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - fi - cd $COMPONENT_SRC && mkdir "$BUILD_DIR" - - git config --global --add safe.directory "$COMPONENT_SRC" - # Rename the remote set by the repo tool to origin as - # git submodule update looks for the remote origin. - remote_name=$(git remote show | head -n 1) - echo "remote name: $remote_name" - [ "$remote_name" == "origin" ] || git remote rename "$remote_name" origin - git remote -v - git submodule update --init --force - - # if GPU_ENABLE_GPU_ARCHARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value. This will override any of the case values above - if [ -n "$ENABLE_GPU_ARCH" ]; then - #setting gfx arch as part of rocm_common_cmake_params - set_gpu_arch "${ENABLE_GPU_ARCH}" - fi - - init_rocm_common_cmake_params - - CXX=$(set_build_variables __CXX__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DBUILD_TEST=ON \ - -DBUILD_BENCHMARK=ON \ - -DBUILD_CRUSH_TEST=ON \ - -DDEPENDENCIES_FORCE_DOWNLOAD=OFF \ - -DHIP_COMPILER=clang \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip" \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -B "${BUILD_DIR}" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocrand() { - echo "Cleaning rocRAND build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocrand; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocrand ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocrsamples.sh b/tools/rocm-build/build_rocrsamples.sh deleted file mode 100755 index 8d2c5de45..000000000 --- a/tools/rocm-build/build_rocrsamples.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [-c|-r|-h] [makeopts]" - echo - echo "Options:" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -c, --clean Removes all RocR Samples build artifacts" - echo " -e, --emulator Build a version suitable for running on emulator" - echo " -r, --release Build release version RocR Samples (default is debug)" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -g, --gpu_list Semi-colon separated List of gpu architectures that" - echo " kernels will run on; e.g., \"gfx803;gfx900;...\" the" - echo " default is to build kernels for all supported architectures." - echo " -h, --help Prints this help" - echo " makeopts Options to pass to the make command" - echo - - return 0 -} - - -GPU_LIST="gfx803;gfx701;gfx801;gfx802;gfx900;gfx902;gfx906;gfx908" - -TARGET="build" -ROCRTST_SAMPLES_PACKAGE=$(getBinPath)/rocrtst_samples -ROCRTST_SAMPLES_ROOT=$ROCRTST_ROOT/samples -ROCRTST_SAMPLES_BUILD_DIR=$(getBuildPath rocrtst_samples) - -MAKEARG="$DASH_JAY" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_UTILS="$(getUtilsPath)" -ROCRTST_SAMPLES_BUILD_TYPE="debug" -EMULATOR_BUILD=0 -SHARED_LIBS="ON" -CLEAN_OR_OUT=0; -MAKETARGET="deb" -PKGTYPE="deb" - - -#parse the arguments -VALID_STR=`getopt -o hcrawo:seg: --long help,clean,release,outdir:,static,wheel,address_sanitizer,emulator,gpu_list: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - ROCRTST_SAMPLES_BUILD_TYPE="release"; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-o | --outdir ) - exit ;; - (-s | --static) - ack_and_skip_static ;; - (-w | --wheel) - echo "wheel build option accepted and ignored" ; shift ;; - (-e | --emulator ) - EMULATOR_BUILD=1 ; ((CLEAN_OR_OUT|=3)) ; shift ;; - (-g | --gpu_list ) - GPU_LIST=$2 ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean_rocrsamples() { - echo "Removing ROCR Samples" - rm -rf "$ROCRTST_SAMPLES_PACKAGE" - rm -rf "$ROCRTST_SAMPLES_BUILD_DIR" -} - -build_rocrsamples() { - mkdir -p $ROCRTST_SAMPLES_BUILD_DIR - pushd $ROCRTST_SAMPLES_BUILD_DIR - - cmake -DTARGET_DEVICES=$GPU_LIST \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DROCRTST_BLD_TYPE=$ROCRTST_SAMPLES_BUILD_TYPE \ - -DROCM_DIR=$PACKAGE_ROOT \ - -DLLVM_DIR="$ROCM_INSTALL_PATH/llvm/bin" \ - -DOPENCL_DIR=$ROCM_INSTALL_PATH \ - -DEMULATOR_BUILD=$EMULATOR_BUILD \ - $ROCRTST_SAMPLES_ROOT - - echo "Making ROCR Samples:" - cmake --build . -- $MAKEARG - cmake --build . -- sample_kernels - mkdir -p "$ROCRTST_SAMPLES_PACKAGE" - - echo "Copying HSA Sample binaries to $ROCRTST_SAMPLES_PACKAGE" - progressCopy "$ROCRTST_SAMPLES_BUILD_DIR" "$ROCRTST_SAMPLES_PACKAGE" - popd -} - -case $TARGET in - clean) clean_rocrsamples ;; - build) build_rocrsamples ;; - *) die "Invalid target $target" ;; -esac - -echo "Operation complete" -exit 0 - - diff --git a/tools/rocm-build/build_rocshmem.sh b/tools/rocm-build/build_rocshmem.sh deleted file mode 100755 index ba05e012c..000000000 --- a/tools/rocm-build/build_rocshmem.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocSHMEM - -build_rocshmem() { - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - echo "Skip building rocSHMEM becasue of Address Sanitizer" - return 0 - fi - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - echo "Start build rocSHMEM" - - #Build step - cd $COMPONENT_SRC - - #PREREQ STEPS step - # Install OMPI + UCC + UCX - export _ROCM_DIR=$ROCM_INSTALL_PATH - mkdir -p "$BUILD_DIR"/rocshmem - export BUILD_DIR - export MPI_HOME=$BUILD_DIR/install/ompi/ - - # Update PATH and LD_LIBRARY_PATH - # Change to your location, these will be deleted in install_dependencies.sh - export PATH="$BUILD_DIR"/install/ucx/bin:$PATH - export PATH="$BUILD_DIR"/install/ucc/bin:$PATH - export PATH="$BUILD_DIR"/install//ompi/bin:$PATH - - export LD_LIBRARY_PATH="$BUILD_DIR"/install/ucx/lib:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH="$BUILD_DIR"/install/ucc/lib:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH="$BUILD_DIR"/install/ompi/lib:$LD_LIBRARY_PATH - - $COMPONENT_SRC/scripts/install_dependencies.sh - - cd "$BUILD_DIR"/rocshmem - init_rocm_common_cmake_params - - CXX="$ROCM_ROOT"/bin/hipcc \ - cmake "${rocm_math_common_cmake_params[@]}"\ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=$ROCM_INSTALL_PATH \ - -DCMAKE_VERBOSE_MAKEFILE=OFF \ - -DDEBUG=OFF \ - -DPROFILE=OFF \ - -DUSE_GPU_IB=OFF \ - -DUSE_RO=OFF \ - -DUSE_DC=OFF \ - -DUSE_IPC=ON \ - -DUSE_COHERENT_HEAP=ON \ - -DUSE_THREADS=OFF \ - -DUSE_WF_COAL=OFF \ - -DUSE_SINGLE_NODE=ON \ - -DUSE_HOST_SIDE_HDP_FLUSH=OFF \ - $COMPONENT_SRC - - cmake --build "$BUILD_DIR"/rocshmem -- -j${PROC} - cmake --build "$BUILD_DIR"/rocshmem -- install - cmake --build "$BUILD_DIR"/rocshmem -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"deb;rpm"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/rocshmem/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocshmem() { - echo "Cleaning rocSHMEM build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocshmem; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocshmem ;; - *) die "Invalid target $TARGET" ;; -esac \ No newline at end of file diff --git a/tools/rocm-build/build_rocsolver.sh b/tools/rocm-build/build_rocsolver.sh deleted file mode 100755 index 0d2fe79fd..000000000 --- a/tools/rocm-build/build_rocsolver.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocSOLVER - -build_rocsolver() { - echo "Start build" - - SHARED_LIBS="ON" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - EXTRA_TESTS="ON" - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - rebuild_lapack - EXTRA_TESTS="OFF" - # updating GPU_ARCHS for ASAN build to supported gpu arch only SWDEV-479178 - #GPU_ARCHS="gfx90a:xnack+;gfx942:xnack+"#This will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - fi - cd $COMPONENT_SRC - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - # if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value. This will override any of the case values above - if [ -n "$ENABLE_GPU_ARCH" ]; then - #setting gfx arch as part of rocm_common_cmake_params - set_gpu_arch "${ENABLE_GPU_ARCH}" - fi - - init_rocm_common_cmake_params - CXX=$(set_build_variables __HIP_CC__) \ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -Drocblas_DIR="${ROCM_PATH}/rocblas/lib/cmake/rocblas" \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_TESTING=ON \ - -DBUILD_CLIENTS_EXTRA_TESTS="${EXTRA_TESTS}" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - mkdir $PACKAGE_DIR && cp ${BUILD_DIR}/*.${PKGTYPE} $PACKAGE_DIR - - show_build_cache_stats -} - -clean_rocsolver() { - echo "Cleaning rocSOLVER build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocsolver; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocsolver ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocsparse.sh b/tools/rocm-build/build_rocsparse.sh deleted file mode 100755 index 8ef103349..000000000 --- a/tools/rocm-build/build_rocsparse.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -PATH=${ROCM_PATH}/bin:$PATH -set_component_src rocSPARSE - -build_rocsparse() { - echo "Start build" - cd $COMPONENT_SRC - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # updating GPU_ARCHS for ASAN build to supported gpu arch only SWDEV-479178 - #GPU_ARCHS="gfx90a:xnack+;gfx942:xnack+"#This will be part of compute_utils.sh ROCMOPS-7302 & ROCMOPS-8091 - fi - SHARED_LIBS="ON" - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - SHARED_LIBS="OFF" - fi - - MIRROR="http://compute-artifactory.amd.com/artifactory/list/rocm-generic-local/mathlib/sparse/" - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - # if ENABLE_GPU_ARCH is set in env by Job parameter ENABLE_GPU_ARCH, then set GFX_ARCH to that value. This will override any of the case values above - if [ -n "$ENABLE_GPU_ARCH" ]; then - #setting gfx arch as part of rocm_common_cmake_params - set_gpu_arch "${ENABLE_GPU_ARCH}" - fi - - init_rocm_common_cmake_params - ROCSPARSE_TEST_MIRROR=$MIRROR \ - CXX=$(set_build_variables __CXX__)\ - CC=$(set_build_variables __CC__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - -DBUILD_CLIENTS_SAMPLES=ON \ - -DBUILD_CLIENTS_TESTS=ON \ - -DBUILD_CLIENTS_BENCHMARKS=ON \ - -DCMAKE_INSTALL_PREFIX=${ROCM_PATH} \ - -DBUILD_ADDRESS_SANITIZER="${ADDRESS_SANITIZER}" \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocsparse() { - echo "Cleaning rocSPARSE build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocsparse; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocsparse ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rocthrust.sh b/tools/rocm-build/build_rocthrust.sh deleted file mode 100755 index 9a5183ef7..000000000 --- a/tools/rocm-build/build_rocthrust.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -build_release=true -set_component_src rocThrust - -build_rocthrust() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - cd $COMPONENT_SRC - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # ASAN packaging is not required for rocThrust, since its header only package - # Setting the asan_cmake_params to false will disable ASAN packaging - ASAN_CMAKE_PARAMS="false" - fi - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - - init_rocm_common_cmake_params - CXX=$(set_build_variables __CXX__)\ - cmake \ - ${LAUNCHER_FLAGS} \ - "${rocm_math_common_cmake_params[@]}" \ - -DCMAKE_MODULE_PATH="${ROCM_PATH}/lib/cmake/hip;${ROCM_PATH}/hip/cmake" \ - -DROCPRIM_ROOT="${ROCM_PATH}/rocprim" \ - -DBUILD_TEST=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - - show_build_cache_stats -} - -clean_rocthrust() { - echo "Cleaning rocThrust build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - (clean) clean_rocthrust ;; - (build) build_rocthrust; build_wheel ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_roctracer.sh b/tools/rocm-build/build_roctracer.sh deleted file mode 100755 index 99f14e9fa..000000000 --- a/tools/rocm-build/build_roctracer.sh +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/bash -source "$(dirname $BASH_SOURCE)/compute_utils.sh" - -printUsage() { - echo - echo "Usage: ${BASH_SOURCE##*/} [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -o, --outdir Print path of output directory containing packages of - type referred to by pkg_type" - echo " -s, --static Component/Build does not support static builds just accepting this param & ignore. No effect of the param on this build" - echo " -w, --wheel Creates python wheel package of roc-tracer. - It needs to be used along with -r option" - echo " -h, --help Prints this help" - echo - - return 0 -} - -## Build environment variables -API_NAME="roctracer" -PROJ_NAME="$API_NAME" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_INCLUDE="$(getIncludePath)" -BUILD_DIR="$(getBuildPath $API_NAME)" -PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -PACKAGE_PREFIX="$ROCM_INSTALL_PATH" - -export HIP_PATH="${ROCM_INSTALL_PATH}" -export HCC_HOME="${PACKAGE_ROOT}/hcc" - -TARGET="build" -BUILD_TYPE="Debug" -MAKE_OPTS="$DASH_JAY -C $BUILD_DIR" -HIP_VDI=1 -SHARED_LIBS="ON" -CLEAN_OR_OUT=0 -MAKETARGET="deb" -PKGTYPE="deb" - -# Handling GPU Targets for HSACO and HIP Executables -GPU_LIST="gfx900;gfx906;gfx908;gfx90a;gfx940;gfx941;gfx942;gfx1030;gfx1031;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201" - -#parse the arguments -VALID_STR=$(getopt -o hcraswo: --long help,clean,release,static,wheel,address_sanitizer,outdir: -- "$@") -eval set -- "$VALID_STR" - -while true; do - #echo "parocessing $1" - case "$1" in - -h | --help) - printUsage - exit 0 - ;; - -c | --clean) - TARGET="clean" - ((CLEAN_OR_OUT |= 1)) - shift - ;; - -r | --release) - BUILD_TYPE="RelWithDebInfo" - shift - ;; - -a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on - shift - ;; - -s | --static) - ack_and_skip_static - ;; - -w | --wheel) - WHEEL_PACKAGE=true - shift - ;; - -o | --outdir) - TARGET="outdir" - PKGTYPE=$2 - OUT_DIR_SPECIFIED=1 - ((CLEAN_OR_OUT |= 2)) - shift 2 - ;; - --) - shift - break - ;; # end delimiter - *) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] " >&2 - exit 20 - ;; - esac - -done - -RET_CONFLICT=1 -check_conflicting_options $CLEAN_OR_OUT $PKGTYPE $MAKETARGET -if [ $RET_CONFLICT -ge 30 ]; then - print_vars $API_NAME $TARGET $BUILD_TYPE $SHARED_LIBS $CLEAN_OR_OUT $PKGTYPE $MAKETARGET - exit $RET_CONFLICT -fi - -clean() { - echo "Cleaning $PROJ_NAME" - rm -rf "$BUILD_DIR" - rm -rf "$PACKAGE_DEB" - rm -rf "$PACKAGE_RPM" - rm -rf "$PACKAGE_INCLUDE/${PROJ_NAME}" - rm -rf "$PACKAGE_ROOT/${PROJ_NAME}" -} - -build() { - echo "Building $PROJ_NAME" - # The cmake path is different for asan and non-asan builds. - # Fetch after getting build type. Default will be non-asan build - PACKAGE_CMAKE="$(getCmakePath)" - # Find HIP in the build tree - export ROCM_PATH="${ROCM_INSTALL_PATH}" - export HIPCC_COMPILE_FLAGS_APPEND="--rocm-path=$ROCM_PATH" - - if [ ! -d "$BUILD_DIR" ]; then - mkdir -p "$BUILD_DIR" - pushd "$BUILD_DIR" - print_lib_type $SHARED_LIBS - - export HIPCC_COMPILE_FLAGS_APPEND="--rocm-path=$ROCM_PATH --offload-arch=gfx900 --offload-arch=gfx906 --offload-arch=gfx908 \ - --offload-arch=gfx90a --offload-arch=gfx940 --offload-arch=gfx941 \ - --offload-arch=gfx942 --offload-arch=gfx1030 --offload-arch=gfx1031 \ - --offload-arch=gfx1100 --offload-arch=gfx1101 --offload-arch=gfx1102 \ - --offload-arch=gfx1200 --offload-arch=gfx1201" - cmake $(rocm_cmake_params) \ - -DCPACK_PACKAGING_INSTALL_PREFIX="$PACKAGE_PREFIX/$PROJ_NAME" \ - -DCMAKE_MODULE_PATH="$PACKAGE_CMAKE/hip" \ - -DCMAKE_HIP_ARCHITECTURES=OFF \ - -DBUILD_SHARED_LIBS=$SHARED_LIBS \ - $(rocm_common_cmake_params) \ - -DCMAKE_HIP_ARCHITECTURES=OFF \ - -DENABLE_LDCONFIG=OFF \ - -DROCM_ROOT_DIR="$ROCM_INSTALL_PATH" \ - -DHIP_VDI="$HIP_VDI" \ - -DROCM_RPATH="$ROCM_RPATH" \ - -DGPU_TARGETS="$GPU_LIST" \ - -DCPACK_OBJCOPY_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-objcopy" \ - -DCPACK_READELF_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-readelf" \ - -DCPACK_STRIP_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-strip" \ - -DCPACK_OBJDUMP_EXECUTABLE="${ROCM_INSTALL_PATH}/llvm/bin/llvm-objdump" \ - "$ROCTRACER_ROOT" - - popd - fi - cmake --build "$BUILD_DIR" -- $MAKE_OPTS - cmake --build "$BUILD_DIR" -- $MAKE_OPTS mytest - cmake --build "$BUILD_DIR" -- $MAKE_OPTS doc - cmake --build "$BUILD_DIR" -- $MAKE_OPTS install - cmake --build "$BUILD_DIR" -- $MAKE_OPTS package - - copy_if DEB "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_DEB" "$BUILD_DIR/${API_NAME}"*.deb - copy_if RPM "${CPACKGEN:-"DEB;RPM"}" "$PACKAGE_RPM" "$BUILD_DIR/${API_NAME}"*.rpm -} - -print_output_directory() { - case ${PKGTYPE} in - "deb") - echo ${PACKAGE_DEB} - ;; - "rpm") - echo ${PACKAGE_RPM} - ;; - *) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2 - exit 1 - ;; - esac - exit -} -verifyEnvSetup - -case $TARGET in -clean) clean ;; -build) build ; build_wheel "$BUILD_DIR" "$PROJ_NAME" ;; -outdir) print_output_directory ;; -*) die "$BASH_SOURCE Invalid target $TARGET - exiting" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_rocwmma.sh b/tools/rocm-build/build_rocwmma.sh deleted file mode 100755 index d820b1472..000000000 --- a/tools/rocm-build/build_rocwmma.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -set -ex -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rocWMMA - -build_rocwmma() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - # To check if rocwmma source is present - if [ ! -e $COMPONENT_SRC/CMakeLists.txt ]; then - echo "Skipping rocWMMA as source is not available" - mkdir -p $COMPONENT_SRC - exit 0 - fi - - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - # ASAN packaging is not required for rocWMMA, since its header only package - # Setting the asan_cmake_params to false will disable ASAN packaging - ASAN_CMAKE_PARAMS="false" - fi - mkdir -p $BUILD_DIR && cd $BUILD_DIR - - init_rocm_common_cmake_params - CXX=$(set_build_variables __CXX__)\ - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - ${LAUNCHER_FLAGS} \ - -DROCWMMA_BUILD_VALIDATION_TESTS=ON \ - -DROCWMMA_VALIDATE_WITH_ROCBLAS=ON \ - -DROCWMMA_BUILD_BENCHMARK_TESTS=ON \ - -DROCWMMA_BENCHMARK_WITH_ROCBLAS=ON \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cmake --build "$BUILD_DIR" -- package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_rocwmma() { - echo "Cleaning rocWMMA build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rocwmma; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rocwmma ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_rpp.sh b/tools/rocm-build/build_rpp.sh deleted file mode 100755 index 4ff9dc434..000000000 --- a/tools/rocm-build/build_rpp.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src rpp -DEPS_DIR="$RPP_DEPS_LOCATION" - -LLVM_LIBDIR="${ROCM_PATH}/llvm/lib" -ROCM_LLVM_LIB_RPATH="\$ORIGIN/llvm/lib" -# RPP specific exe linker parameters -rpp_specific_cmake_params() { - local rpp_cmake_params - if [ "${ASAN_CMAKE_PARAMS}" == "true" ] ; then - rpp_cmake_params="-DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_ASAN_EXE_RPATH:$LLVM_LIBDIR" - else - rpp_cmake_params="" - fi - printf '%s ' "${rpp_cmake_params}" -} - -build_rpp() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - # To check if RPP source is present - if [ ! -e $COMPONENT_SRC/CMakeLists.txt ]; then - echo "Skipping RPP build as source is not available" - mkdir -p $COMPONENT_SRC - exit 0 - fi - - CXX=$(set_build_variables __AMD_CLANG_++__) - # Enable ASAN - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ]; then - set_asan_env_vars - set_address_sanitizer_on - fi - - echo "C compiler: $CC" - echo "CXX compiler: $CXX" - mkdir -p $BUILD_DIR && cd $BUILD_DIR - init_rocm_common_cmake_params - # rocm_common_cmake_params provides the default rpath for rocm executables and libraries - # Override cmake shared linker flags to add RPATH for boost libraries - cmake \ - "${rocm_math_common_cmake_params[@]}" \ - ${LAUNCHER_FLAGS} \ - -DBACKEND=HIP \ - -DCMAKE_INSTALL_LIBDIR=$(getInstallLibDir) \ - $(rpp_specific_cmake_params) \ - -DCMAKE_SHARED_LINKER_FLAGS_INIT="-fno-openmp-implicit-rpath -Wl,--enable-new-dtags,--build-id=sha1,--rpath,${ROCM_LIB_RPATH}:${DEPS_DIR}/lib:${ROCM_LLVM_LIB_RPATH}" \ - -DCMAKE_PREFIX_PATH="${DEPS_DIR};${ROCM_PATH}" \ - "$COMPONENT_SRC" - - cmake --build "$BUILD_DIR" -- -j${PROC} - cmake --build "$BUILD_DIR" -- install - cpack -G ${PKGTYPE^^} - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_rpp() { - echo "Cleaning rpp build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_rpp; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_rpp ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/build_thunk.sh b/tools/rocm-build/build_thunk.sh deleted file mode 100755 index 6589ace59..000000000 --- a/tools/rocm-build/build_thunk.sh +++ /dev/null @@ -1,228 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE}")/compute_utils.sh" - -printUsage() { - echo - echo "Usage: $(basename "${BASH_SOURCE}") [options ...]" - echo - echo "Options:" - echo " -c, --clean Clean output and delete all intermediate work" - echo " -p, --package Specify packaging format" - echo " -r, --release Make a release build instead of a debug build" - echo " -a, --address_sanitizer Enable address sanitizer" - echo " -w, --wheel Creates python wheel package of thunk. It needs to be used along with -r option" - echo " -o, --outdir Print path of output directory containing packages of type referred to by pkg_type" - echo " -h, --help Prints this help" - echo " -s, --static Build static lib (.a). build instead of dynamic/shared(.so) " - echo - echo "Possible values for :" - echo " deb -> Debian format (default)" - echo " rpm -> RPM format" - echo - - return 0 -} - -## Thunk build (using Makefile) environment variables -PROJ_NAME="roct" -PACKAGE_ROOT="$(getPackageRoot)" -PACKAGE_DEB="$(getPackageRoot)/deb/libhsakmt" -PACKAGE_RPM="$(getPackageRoot)/rpm/libhsakmt" -THUNK_BUILD_DIR="$(getBuildPath thunk)" -TARGET="build" -MAKETARGET="deb" -MAKEARG="$DASH_JAY O=$THUNK_BUILD_DIR" -PACKAGE_LIB="$(getLibPath)" -PACKAGE_INCLUDE="$(getIncludePath)" -SHARED_LIBS="ON" -STATIC_FLAG= - -## ROCt build (using CMake) environment variables -ROCT_BUILD_DIR="$(getBuildPath $PROJ_NAME)" -ROCT_PACKAGE_DEB="$PACKAGE_ROOT/deb/$PROJ_NAME" -ROCT_PACKAGE_RPM="$PACKAGE_ROOT/rpm/$PROJ_NAME" -ROCT_BUILD_TYPE="debug" -BUILD_TYPE="Debug" -ROCT_MAKE_OPTS="$DASH_JAY -C $ROCT_BUILD_DIR" -CLEAN_OR_OUT=0; - -#debug function -print_vars() { -echo " Var status thunk " -echo "TARGET= $TARGET" -echo "BUILD_TYPE = $BUILD_TYPE" -echo "MAKETARGE = $MAKETARGET" -echo "CLEAN_OR_OUT = $CLEAN_OR_OUT" -echo "PKGTYPE= $PKGTYPE" -} - -check_conflicting_options() { - - if [ "$MAKETARGET" != "deb" ] && [ "$MAKETARGET" != "rpm" ] && [ "$MAKETARGET" != "tar" ]; then - echo " Wrong Param Passed for Package Type. Aborting .. " - print_vars - exit 30 - fi - #echo " CLEAN_OR_OUT = $CLEAN_OR_OUT " - if [ $CLEAN_OR_OUT -ge 2 ]; then - if [ "$PKGTYPE" != "deb" ] && [ "$PKGTYPE" != "rpm" ] && [ "$PKGTYPE" != "tar" ]; then - echo " Wrong Param Passed for Package Type for the Outdir. Aborting .. " - print_vars - exit 40 - fi - fi - # check Clean Vs Outdir - if [ $CLEAN_OR_OUT -ge 3 ]; then - echo " Clean & Out Both are sepcified. Not accepted. Bailing .. " - exit 50 - fi -} - -#parse the arguments -VALID_STR=`getopt -o hcraswo:p: --long help,clean,release,address_sanitizer,wheel,clean,outdir:,package: -- "$@"` -eval set -- "$VALID_STR" - -while true ; -do - #echo "parocessing $1" - case "$1" in - (-h | --help) - printUsage ; exit 0;; - (-c | --clean) - TARGET="clean" ; ((CLEAN_OR_OUT|=1)) ; shift ;; - (-r | --release) - BUILD_TYPE="RelWithDebInfo" ; shift ;; - (-a | --address_sanitizer) - set_asan_env_vars - set_address_sanitizer_on ; shift ;; - (-s | --static) - SHARED_LIBS="OFF" ; - STATIC_FLAG="-DBUILD_SHARED_LIBS=$SHARED_LIBS" ; shift ;; - (-w | --wheel) - WHEEL_PACKAGE=true ; shift ;; - (-o | --outdir) - TARGET="outdir"; PKGTYPE=$2 ; OUT_DIR_SPECIFIED=1 ; ((CLEAN_OR_OUT|=2)) ; shift 2 ;; - (-p | --package) - MAKETARGET="$2" ; shift 2;; - --) shift; break;; # end delimiter - (*) - echo " This should never come but just incase : UNEXPECTED ERROR Parm : [$1] ">&2 ; exit 20;; - esac - -done - -check_conflicting_options - - -clean_roct() { - rm -rf "$ROCT_BUILD_DIR" - rm -rf "$ROCT_PACKAGE_DEB" - rm -rf "$ROCT_PACKAGE_RPM" - rm -rf "$PACKAGE_ROOT/libhsakmt" - rm -rf "$PACKAGE_INCLUDE/libhsakmt" - rm -f $PACKAGE_LIB/libhsakmt.so* - rm -f $PACKAGE_LIB/libhsakmt.a - rm -f $PACKAGE_INCLUDE/hsakmt*.h $PACKAGE_INCLUDE/linux/kfd_ioctl.h -} - -build_roct() { - echo "Building ROCt" - - # Clean up the deb and rpm files first to avoid multiple versions - rm -f $ROCT_BUILD_DIR/hsakmt-roct*.deb - rm -f $ROCT_BUILD_DIR/hsakmt-roct-dev/hsakmt-roct*.deb - rm -f "$ROCT_PACKAGE_DEB"/* - - rm -f $ROCT_BUILD_DIR/hsakmt-roct*.rpm - rm -f $ROCT_BUILD_DIR/hsakmt-roct-dev/hsakmt-roct*.rpm - rm -f "$ROCT_PACKAGE_RPM"/* - - # Set pkg config path for Static builds - # so that static libraries of drm and libdrm_amdgpu will get linked - if [ "$SHARED_LIBS" == "OFF" ]; then - install_drmStatic_lib - fi - # Set this variable only for CentOS 7, as this does not - # allow the "suggests" field for the generated package. - if [ "${DISTRO_ID}" = "centos-7" ]; then - libdrm_cmake_var="-DHSAKMT_REQUIRES_LIBDRM=true" - fi - - if [ ! -d "$ROCT_BUILD_DIR" ]; then - mkdir -p "$ROCT_BUILD_DIR" - pushd "$ROCT_BUILD_DIR" - - cmake \ - -DCMAKE_MODULE_PATH="$THUNK_ROOT/cmake_modules" \ - -DBUILD_SHARED_LIBS="OFF" \ - $(rocm_cmake_params) \ - $(rocm_common_cmake_params) \ - -DHSAKMT_INSTALL_PREFIX="$PACKAGE_ROOT" \ - -DHSAKMT_INSTALL_LIBDIR="$PACKAGE_LIB" \ - -DHSAKMT_PACKAGING_INSTALL_PREFIX="$ROCM_PATH" \ - -DENABLE_LDCONFIG=OFF \ - -DHSAKMT_WERROR=1 \ - -DADDRESS_SANITIZER="$ADDRESS_SANITIZER" \ - $libdrm_cmake_var \ - "$THUNK_ROOT" - popd - fi - cmake --build "$ROCT_BUILD_DIR" -- $ROCT_MAKE_OPTS - cmake --build "$ROCT_BUILD_DIR" -- $ROCT_MAKE_OPTS install - cmake --build "$ROCT_BUILD_DIR" -- $ROCT_MAKE_OPTS package - - if [ -e "$THUNK_ROOT/hsakmt-dev.txt" ]; then - cmake --build "$ROCT_BUILD_DIR" -- $ROCT_MAKE_OPTS install-dev - cmake --build "$ROCT_BUILD_DIR" -- $ROCT_MAKE_OPTS package-dev - fi - - mkdir -p "$PACKAGE_LIB" - # We have both here as we transition from shared to static lib - if [ -e "$ROCT_BUILD_DIR/libhsakmt.so" ]; then - # If the .so exists, so will the .so.1 and such - cp -R "$ROCT_BUILD_DIR/libhsakmt.so"* "$PACKAGE_LIB" - fi - if [ -e "$ROCT_BUILD_DIR/libhsakmt.a" ]; then - cp -R "$ROCT_BUILD_DIR/libhsakmt.a" "$PACKAGE_LIB" - fi - - mkdir -p "$ROCT_PACKAGE_DEB" - if [[ "${CPACKGEN:-"DEB;RPM"}" =~ "DEB" ]] ; then - cp -a $ROCT_BUILD_DIR/hsakmt*.deb "$ROCT_PACKAGE_DEB" - if [ -e "$THUNK_ROOT/hsakmt-dev.txt" ]; then - cp -a $ROCT_BUILD_DIR/hsakmt-roct-dev/hsakmt-roct*.deb "$ROCT_PACKAGE_DEB" - fi - fi - - mkdir -p "$ROCT_PACKAGE_RPM" - if [[ "${CPACKGEN:-"DEB;RPM"}" =~ "RPM" ]] ; then - cp -a $ROCT_BUILD_DIR/hsakmt*.rpm "$ROCT_PACKAGE_RPM" - if [ -e "$THUNK_ROOT/hsakmt-dev.txt" ]; then - cp -a $ROCT_BUILD_DIR/hsakmt-roct-dev/hsakmt-roct*.rpm "$ROCT_PACKAGE_RPM" - fi - fi -} - -print_output_directory() { - case ${PKGTYPE} in - ("deb") - echo ${ROCT_PACKAGE_DEB};; - ("rpm") - echo ${ROCT_PACKAGE_RPM};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -verifyEnvSetup - -case $TARGET in - (clean) clean_roct ;; - (build) build_roct; build_wheel "$ROCT_BUILD_DIR" "$PROJ_NAME" ;; - (outdir) print_output_directory ;; - (*) die "Invalid target $TARGET" ;; -esac - -echo "Operation complete" diff --git a/tools/rocm-build/build_transferbench.sh b/tools/rocm-build/build_transferbench.sh deleted file mode 100755 index 0b735ec89..000000000 --- a/tools/rocm-build/build_transferbench.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -ex - -source "$(dirname "${BASH_SOURCE[0]}")/compute_utils.sh" - -set_component_src TransferBench - -build_transferbench() { - echo "Start build" - - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - ack_and_skip_static - fi - - mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR" - init_rocm_common_cmake_params - - CXX=$(set_build_variables __HIP_CC__) \ - cmake "${rocm_math_common_cmake_params[@]}" "$COMPONENT_SRC" - make package - - rm -rf _CPack_Packages/ && find -name '*.o' -delete - copy_if "${PKGTYPE}" "${CPACKGEN:-"DEB;RPM"}" "${PACKAGE_DIR}" "${BUILD_DIR}"/*."${PKGTYPE}" - show_build_cache_stats -} - -clean_transferbench() { - echo "Cleaning TransferBench build directory: ${BUILD_DIR} ${PACKAGE_DIR}" - rm -rf "$BUILD_DIR" "$PACKAGE_DIR" - echo "Done!" -} - -stage2_command_args "$@" - -case $TARGET in - build) build_transferbench; build_wheel ;; - outdir) print_output_directory ;; - clean) clean_transferbench ;; - *) die "Invalid target $TARGET" ;; -esac diff --git a/tools/rocm-build/compute_utils.sh b/tools/rocm-build/compute_utils.sh deleted file mode 100755 index 930099fce..000000000 --- a/tools/rocm-build/compute_utils.sh +++ /dev/null @@ -1,769 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -TOPOLOGY_SYSFS_DIR=/sys/devices/virtual/kfd/kfd/topology/nodes - -# Set python version -# TODO: Get the python version from build arguments -PY_COMMAND=python3.6 -# Set a sensible default value for DASH_JAY in case none is provided -DASH_JAY=${DASH_JAY:-"-j $(nproc)"} - -# Enable ccache by default unless requested otherwhise -if [[ "$ROCM_USE_CCACHE" != "0" ]] ; then - for d in /usr/lib/ccache /usr/lib64/ccache ;do - if [ -d "$d" ]; then - PATH="$d:$PATH" - break # Only add one ccache at most - fi - done -fi - -# TODO: To be removed, once debug package issues are fixed -DISABLE_DEBUG_PACKAGE="false" -set_gdwarf_4() { -# In SLES and RHEL, debuginfo package is not getting generated -# Splitting debuginfo is getting failed(dwarf-5 unhandled) when compiler is set to clang. -# By default -gdwarf-5 is used for the compression of debug symbols -# So setting -gdwarf-4 as a quick fix -# TODO: -gdwarf-5 unhandling when compiler set to clang need to be fixed - case "$DISTRO_ID" in - (sles*|rhel*) - SET_DWARF_VERSION_4="-gdwarf-4" - ;; - (*) - SET_DWARF_VERSION_4="" - ;; - esac -} - -# Print message to stderr -# param message string to print on exit -# Example: printErr "file not found" -printErr() { - echo "$@" 1>&2 -} - -# Print message to stderr and terminate current program -# param message string to print on exit -# Example: die "Your program" has terminated -die() { - printErr "FATAL: $@" - exit 1 -} - -# Die if first argument is empty -# param string to validate -# param error message -# Example: die "$VARIABLE" "Your program" has terminated -dieIfEmpty() { - if [ "$1" == "" ]; then - shift - die "$@" - fi -} - -# Get directory with build output package -# Precedence: -# 1. PWD -# 2. Caller's folder -# 3. Known build output folder -getPackageRoot() { - local scriptPath=$(readlink -f $(dirname $BASH_SOURCE)) - local testFile="build.version" - - if [ -a "$PWD/$testFile" ]; then - echo "$PWD" - elif [ -a "$scriptPath/../$testFile" ]; then - echo "$scriptPath/.." - elif [ -a "$scriptPath/$testFile" ]; then - echo "$scriptPath" - elif [ ! -z "$OUT_DIR" ]; then - echo "$OUT_DIR" - else - die "Failed to determine package directory" - fi -} - -# Get a list of directories containing the build output -# shared objects. -# Important: PWD takes precedence over build output folder -getLibPath() { - local packageRoot="$(getPackageRoot)" - dieIfEmpty "$packageRoot" - echo "$packageRoot/lib" -} - -# Get a list of directories containing the output executables -# param binDir (optional) - package name -# Important: PWD takes precedence over build output folder -getBinPath() { - local binDir="$1" - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - - if [ "$binDir" == "" ]; then - echo "$packageRoot/bin" - else - echo "$packageRoot/bin/$binDir" - fi -} - -# Get a list of directories containing the output source files -# Important: PWD takes precedence over build output folder -getSrcPath() { - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - echo "$packageRoot/src" -} - -# Get a list of directories to place build output -# param moduleName - name of the module for the build path -# Important: PWD takes precedence over build output folder -getBuildPath() { - local moduleName="$1" - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - echo "$packageRoot/build/$moduleName" -} - -# Get a list of directories containing the output etc files -# Important: PWD takes precedence over build output folder -getUtilsPath() { - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - echo "$packageRoot/utils" -} - -# Get a list of directories containing the output include files -# Important: PWD takes precedence over build output folder -getIncludePath() { - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - echo "$packageRoot/include" -} - -# Get the directory containing the cmake config files -getCmakePath() { - local rocmInstallPath=${ROCM_INSTALL_PATH} - local cmakePath="lib/cmake" - if [ "$ASAN_CMAKE_PARAMS" == "true" ] ; then - cmakePath="lib/asan/cmake" - fi - dieIfEmpty "$rocmInstallPath" - echo "$rocmInstallPath/$cmakePath" -} - -# Get a list of directories containing the output debian files -# Important: PWD takes precedence over build output folder -getDebPath() { - local packageName="$1" - dieIfEmpty "$packageName" "No valid package name specified" - - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - - echo "$packageRoot/deb/$packageName" -} - -# Get a list of directories containing the output rpm files -# Important: PWD takes precedence over build output folder -getRpmPath() { - local packageName="$1" - dieIfEmpty "$packageName" "No valid package name specified" - - local packageRoot=$(getPackageRoot) - dieIfEmpty "$packageRoot" - - echo "$packageRoot/rpm/$packageName" -} - - -verifyEnvSetup() { - if [ -z "$OUT_DIR" ]; then - die "Please source build/envsetup.sh first." - fi -} - -# Copy a file or directory to target location and show single line progress -progressCopy() { - if [ -d "$1" ]; then - rsync -a "$1"/* "$2" - else - rsync -a "$1" "$2" - fi -} - - -#following three common functions have been written to addition of static libraries -print_lib_type() { - if [ "$1" == "OFF" ]; - then - echo " Building Archive " - else - echo " Building Shared Object " - fi -} - -check_conflicting_options() { - # 1->CLEAN_OR_OUT 2->PKGTYPE 3->MAKETARGET - RET_CONFLICT=0 - if [ $1 -ge 2 ]; then - if [ "$2" != "deb" ] && [ "$2" != "rpm" ] && [ "$2" != "tar" ]; then - echo " Wrong Param Passed for Package Type for the Outdir... " - RET_CONFLICT=30 - fi - fi - # check Clean Vs Outdir - if [ $1 -ge 3 ] && [ $RET_CONFLICT -eq 0 ] ; then - echo " Clean & Out Both are sepcified. Not accepted. Bailing .. " - RET_CONFLICT=40 - fi - if [ $RET_CONFLICT -eq 0 ] && [ "$3" != "deb" ] && [ "$3" != "rpm" ] && [ "$3" != "all" ] && [ "$3" != "tar" ]; then - echo " Wrong Param Passed for Package Type... " - RET_CONFLICT=50 - fi -} - -# Set the LLVM directory path with respect to ROCM_PATH -# LLVM is installed in $ROCM_PATH/lib/llvm -ROCM_LLVMDIR="lib/llvm" - -export ADDRESS_SANITIZER="OFF" -set_asan_env_vars() { - export ADDRESS_SANITIZER="ON" - # Flag to set cmake build params for ASAN builds - ASAN_CMAKE_PARAMS="true" - # Pass the LLVM bin path as the first parameter - local LLVM_BIN_DIR=${1:-"${ROCM_INSTALL_PATH}/llvm/bin"} - export CC="$LLVM_BIN_DIR/clang" - export CXX="$LLVM_BIN_DIR/clang++" - export FC="$LLVM_BIN_DIR/flang" - export PATH="$PATH:$LLVM_BIN_DIR/" - # get exact path to ASAN lib containing clang version - ASAN_LIB_PATH=$(clang --print-file-name=libclang_rt.asan-x86_64.so) - export LD_LIBRARY_PATH="${ASAN_LIB_PATH%/*}:${ROCM_PATH}/${ROCM_LLVMDIR}/lib:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - export ASAN_OPTIONS="detect_leaks=0" -} - -set_address_sanitizer_on() { - set_gdwarf_4 - export CFLAGS="-fsanitize=address -shared-libasan -g -gz $SET_DWARF_VERSION_4" - export CXXFLAGS="-fsanitize=address -shared-libasan -g -gz $SET_DWARF_VERSION_4" - export LDFLAGS="-Wl,--enable-new-dtags -fuse-ld=lld -fsanitize=address -shared-libasan -g -gz -Wl,--build-id=sha1 -L${ROCM_PATH}/${ROCM_LLVMDIR}/lib -L${ROCM_PATH}/lib/asan -L${ROCM_PATH}/${ROCM_LLVMDIR}/lib/asan" -} - -rebuild_lapack() { - wget -nv -O lapack-3.9.1.tar.gz \ - http://compute-artifactory.amd.com/artifactory/rocm-generic-thirdparty-deps/ubuntu/lapack-v3.9.1.tar.gz - sh -c "echo 'd0085d2caf997ff39299c05d4bacb6f3d27001d25a4cc613d48c1f352b73e7e0 *lapack-3.9.1.tar.gz' | sha256sum -c" - tar xzf lapack-3.9.1.tar.gz --one-top-level=lapack-src --strip-components 1 - rm lapack-3.9.1.tar.gz - - cmake -Slapack-src -Blapack-bld \ - ${LAUNCHER_FLAGS} \ - -DBUILD_TESTING=OFF \ - -DCBLAS=ON \ - -DLAPACKE=OFF - cmake --build lapack-bld -- -j${PROC} - sudo -E $(which cmake) --build lapack-bld -- install - rm -rf lapack-src lapack-bld -} - -ack_and_ignore_asan() { - echo "-a parameter accepted but ignored" -} - -ack_and_skip_static() { - echo "-s parameter accepted but static build is not enabled for this component..skipping" - exit 0 -} - -#debug function #dumping values in case of error to solve the same -print_vars() { - echo " Status of Vars in $1 build " - echo " TARGET= $2 " - echo " BUILD_TYPE = $3 " - echo " SHARED_LIBS = $4 " - echo " CLEAN_OR_OUT = $5 " - echo " PKGTYPE= $6 " - echo " MAKETARGET = $7 " -} - -# Provide this as a function, rather than a variable to delay the evaluation -# of variables. In particular we might want to put code in here which changes -# depending on if we are building with the address sanitizer or not -# Can do things like set the packaging type - no point in packaging RPM on debian and -# vica versa. -# Set CPACK_RPM_INSTALL_WITH_EXEC so it packages debug info for shared libraries. -rocm_common_cmake_params(){ - if [ "$BUILD_TYPE" = "RelWithDebInfo" ] ; then - printf '%s ' "-DCPACK_RPM_DEBUGINFO_PACKAGE=TRUE" \ - "-DCPACK_DEBIAN_DEBUGINFO_PACKAGE=TRUE" \ - "-DCPACK_RPM_INSTALL_WITH_EXEC=TRUE" \ - # end of list comment or blank line - fi - printf '%s ' "-DROCM_DEP_ROCMCORE=ON" \ - "-DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_EXE_RPATH" \ - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LIB_RPATH" \ - "-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF" \ - "-DCPACK_RPM_PACKAGE_RELOCATABLE=ON" \ - "-DCPACK_SET_DESTDIR=OFF" \ - "-DINCLUDE_PATH_COMPATIBILITY=OFF" \ - # set lib directory to lib/asan for ASAN builds - # Disable file reorg backward compatibilty for ASAN builds - # ENABLE_ASAN_PACKAGING - Used for enabling ASAN packaging - if [ "$ASAN_CMAKE_PARAMS" == "true" ] ; then - local asan_common_cmake_params - local ASAN_LIBDIR="lib/asan" - local CMAKE_PATH=$(getCmakePath) - asan_common_cmake_params=( - "-DCMAKE_INSTALL_LIBDIR=$ASAN_LIBDIR" - "-DCMAKE_PREFIX_PATH=$CMAKE_PATH;${ROCM_INSTALL_PATH}/$ASAN_LIBDIR;$ROCM_INSTALL_PATH/llvm;$ROCM_INSTALL_PATH" - "-DENABLE_ASAN_PACKAGING=$ASAN_CMAKE_PARAMS" - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_ASAN_LIB_RPATH" - ) - printf '%s ' "${asan_common_cmake_params[@]}" - else - printf '%s ' "-DCMAKE_INSTALL_LIBDIR=lib" \ - # end of list comment or blank line - fi -} - -rocm_cmake_params() { - local cmake_params - - cmake_params=( - "-DCMAKE_PREFIX_PATH=${ROCM_INSTALL_PATH}/llvm;${ROCM_INSTALL_PATH}" - "-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-'RelWithDebInfo'}" - "-DCMAKE_VERBOSE_MAKEFILE=1" - "-DCPACK_GENERATOR=${CPACKGEN:-'DEB;RPM'}" - "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE" - "-DROCM_PATCH_VERSION=${ROCM_LIBPATCH_VERSION}" - "-DCMAKE_INSTALL_PREFIX=${ROCM_INSTALL_PATH}" - "-DCPACK_PACKAGING_INSTALL_PREFIX=${ROCM_INSTALL_PATH}" - ) - - printf '%s ' "${cmake_params[@]}" -} - -copy_if() { - local type=$1 selector=$2 dir=$3 - shift 3 - mkdir -p "$dir" - if [[ "${selector,,}" =~ "${type,,}" ]] ; then - cp -a "$@" "$dir" - fi - # handle ddeb files as well, renaming them on the way - for f - do - case "$f" in - # Properly formed debian package name is a number of _ separated fields - # The first is the package name. - # Second is version number - # third is architecture - # Ensure we have at least one _ in the name - (*"_"*".deb") - local deb=${f%.deb} - local basename=${deb##*/} - local dirname=${f%/*} - # filename($f) can be either /some/path/pkgname.deb or pkgname.deb - # If its pkgname.deb, then directory should be . - [[ "$dirname" == "$f" ]] && dirname=. - local pkgname=${basename%%_*} - local pkgextra=${basename#*_} - # cmake 3.22 creates the filename by replacing .deb with -dbgsym.ddeb - # at least for hostcall. Mind you hostcall looks to be incorrectly packaged. - if [ -e "${deb}-dbgsym.ddeb" ] - then - dest=${deb##*/} - dest="${dest%%_*}-dbgsym_${dest#*_}" - cp -a "${deb}-dbgsym.ddeb" "$dir/${dest##*/}.deb" - # copying the -dbgsym package to build director as well , as it is used for uploading to artifactory - cp -a "${deb}-dbgsym.ddeb" "$BUILD_DIR/${dest##*/}.deb" - fi - # This is needed for comgr - if [ -e "$dirname/${pkgname}-dbgsym_${pkgextra}.ddeb" ] - then - cp "$dirname/${pkgname}-dbgsym_${pkgextra}.ddeb" "$dir/${pkgname}-dbgsym_${pkgextra}.deb" - fi - ;; - esac - done -} - - -# Function to remove -r or -R from MAKEFLAGS -remove_make_r_flags(){ - local firstword='^[^ ]*' - if [[ "$MAKEFLAGS" =~ ${firstword}r ]] ; then MAKEFLAGS=${MAKEFLAGS/r/} ; fi - if [[ "$MAKEFLAGS" =~ ${firstword}R ]] ; then MAKEFLAGS=${MAKEFLAGS/R/} ; fi -} - - - -# Functions to create wheel packages -install_wheel_prerequisites(){ - sudo yum install -y cpio - $PY_COMMAND -m pip install --upgrade pip - $PY_COMMAND -m pip install --upgrade build wheel setuptools rpm -} -# Before calling create_wheel_packge, make sure to set the global variables -# Global variables: BUILD_SCRIPT_ROOT -create_wheel_package() { - echo "Creating wheel package" - local buildDir="$1" - local projName="$2" - local PKG_INFO="pkginfo" - # Get package output directory from project name - local packageDir="$(getRpmPath $projName)" - local ROCM_WHEEL_DIR="${buildDir}/_wheel" - # Remove the _wheel directory if already exist - rm -rf $ROCM_WHEEL_DIR - mkdir -p $ROCM_WHEEL_DIR - # Copy the setup.py generator to build folder - cp -f $BUILD_SCRIPT_ROOT/setup.py $ROCM_WHEEL_DIR - pushd $ROCM_WHEEL_DIR - - local PKG_NAME_LIST=( "${packageDir}"/*.rpm ) - for pkg in "${PKG_NAME_LIST[@]}"; do - if [[ "$pkg" =~ "-dbgsym" ]] || [[ "$pkg" =~ "-debuginfo" ]]; then - echo "Discarding debug info wheel package. Continue with next package " - continue - fi - pkgFiles=$(rpm -ql "$pkg") - if [[ "$pkgFiles" =~ "contains no files" ]]; then - echo "Package $pkg is empty." - continue - fi - #Clean up any old files - rm -rf opt usr build $PKG_INFO - cat << EOF > "$PKG_INFO" -PKG_NAME=$pkg -EOF - # Currently only supports python3.6 - $PY_COMMAND -m build --wheel -n -C--global-option=--build-number -C--global-option=$BUILD_ID - done - # Copy the wheel created to RPM folder which will be uploaded to artifactory - copy_if WHL "WHL" "$packageDir" "$ROCM_WHEEL_DIR"/dist/*.whl - popd -} - -# Function used by component build scripts for generating wheel package -# Wheel package will be created if WHEEL_PACKAGE is set -build_wheel() { - if [[ "$WHEEL_PACKAGE" != "true" ]] || [[ "$SHARED_LIBS" == "OFF" ]] || [[ "$ENABLE_ADDRESS_SANITIZER" == "true" ]]; then - echo "Wheel Package build disabled !!!!" - return - fi - echo "Wheel Package build started !!!!" - install_wheel_prerequisites - # Input argument - # $1 : Build directory - # $2 : project name - if [ -n "$1" ]; then - create_wheel_package "$1" "$2" - else - create_wheel_package $BUILD_DIR "${PACKAGE_DIR##*/}" - fi -} - -# Set a variable to the value needed by cmake to use ninja if it is available -# If GEN_NINJA is already defined, even as the empty string, then leave the value alone -# Intended use in build_xxxx.sh is ${GEN_NINJA:+"$GEN_NINJA"} to cope with potentially weird values -# but in practice just ${GEN_NINJA} without quotes will be fine. -# e.g. cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" $GEN_NINJA -# If for some reason you wanted to build without ninja just export an empty GEN_NINJA variable -if [ "${GEN_NINJA+defined}" != "defined" ] && command -v ninja >/dev/null ; then - GEN_NINJA=-GNinja -fi - -# Install amdgpu-install-internal package required for running amdpgu-repo and -# set the repo for installing amdgpu static package -set_amdgpu_repo() { - #if amdgpu-repo command doesn't exist, install it - if ! command -v amdgpu-repo &> /dev/null - then - # From ROCm VERSION get the first two numbers eg 6.2.0 --> 6.2 - AMDGPU_INSTALL_VER=${ROCM_VERSION%%.${ROCM_VERSION#?.*.}} - # Currently static builds are triggered in RHEL-8 OS. only yum install is used for time being - # TODO: Should be modified to handle other OS as well - BASE_URL="https://artifactory-cdn.amd.com/artifactory/list/amdgpu-rpm/rhel" - sudo yum install -y "${BASE_URL}/amdgpu-install-internal-${AMDGPU_INSTALL_VER}_8-1.noarch.rpm" - fi - KERNEL_INFO_FILE_URL=http://rocm-ci.amd.com/job/$JOB_NAME/$BUILD_ID/artifact/amdgpu_kernel_info.txt - RADEON_TIER=$(curl "${KERNEL_INFO_FILE_URL}") || die "Failed to set Linux core build number." - AMDGPU_BUILD_OPT="--amdgpu-build=${RADEON_TIER}" - for delay in 0 30 60 120 - do - echo "Sleeping ${delay} seconds" - sleep ${delay}; - sudo amdgpu-repo $AMDGPU_BUILD_OPT --rocm-build="${JOB_NAME}/${BUILD_ID}" && return 0 - echo "Attempt to update repo using amdgpu-repo failed, retrying..." - done - echo "All attempts for amdgpu-repo installation failed, fallback to local repo update and installation!" - return 1 -} - -# Function will install drm static packages and its dependencies -install_drmStatic_lib(){ - if set_amdgpu_repo ; then - sudo yum install -y libdrm-amdgpu-static - else - echo " amdgpu repo setting failed (rc=$?) " - exit 60 - fi -} - - -# Set offload compress to ON by default -DISABLE_OFFLOAD_COMPRESSION="false" -setup_offload_compress(){ - # Enable offload compression based on the flag - if [ "${DISABLE_OFFLOAD_COMPRESSION}" == "false" ] ; then - export CFLAGS="$CFLAGS --offload-compress " - export CXXFLAGS="$CXXFLAGS --offload-compress " - else - # Disable offload compression based on the flag - export CFLAGS=${CFLAGS//" --offload-compress "/ } - export CXXFLAGS=${CXXFLAGS//" --offload-compress "/ } - fi -} - -# Get CMAKE build flags for CMAKE build trigger -set_build_variables() { - - # Variables which changes based on build types ex:ASAN/STATIC Builds. - # Note: - # 1. __CXX__ Argument is for getting the equivalant cmake_cxx_flag_params - # which is clang++ for ASAN/STATIC builds and hipcc for rest all builds. - # 2. __CC__ Argument is for getting the equivalant cmake_cc_flag_params - # which is clang for ASAN/STATIC builds and hipcc for rest all builds. - # 3. Similarly the __CMAKE_CXX_COMPILER__ and __CMAKE_CC_COMPILER__ Arguments - # gives clang++, clang configuration for ASAN/STATIC and hipcc for rest of all builds. - local cxx_flag_params - local cc_flag_params - local LLVM_BIN_DIR="$ROCM_PATH/lib/llvm/bin" - local HIPCC_BIN_DIR="$ROCM_PATH/bin" - - # Set Variable based on build types - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ] || [ "${ENABLE_STATIC_BUILDS}" == "true" ] ; then - cxx_flag_params="$LLVM_BIN_DIR/clang++" - cc_flag_params="$LLVM_BIN_DIR/clang" - else - setup_offload_compress - cxx_flag_params="$HIPCC_BIN_DIR/hipcc" - cc_flag_params="$HIPCC_BIN_DIR/hipcc" - fi - - case "$1" in - ("__C_++__") - printf "%s" "c++" - ;; - ("__G_++__") - printf "%s" "g++" - ;; - ("__AMD_CLANG_++__") - printf "%s" "amdclang++" - ;; - ("__HIP_CC__") - printf "%s" "$HIPCC_BIN_DIR/hipcc" - ;; - ("__CLANG++__") - printf "%s" "$LLVM_BIN_DIR/clang++" - ;; - ("__CLANG__") - printf "%s" "$LLVM_BIN_DIR/clang" - ;; - ("__CXX__") - printf "%s" "${cxx_flag_params}" - ;; - ("__CC__") - printf "%s" "${cc_flag_params}" - ;; - ("__CMAKE_CC_PARAMS__") - printf '%s ' "-DCMAKE_C_COMPILER=${cc_flag_params}" - ;; - ("__CMAKE_CXX_PARAMS__") - printf '%s ' "-DCMAKE_CXX_COMPILER=${cxx_flag_params}" - ;; - (*) - exit 1 - ;; - esac - exit -} - -# Get the install directory name for libraries -getInstallLibDir() { - local libDir="lib" - if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ] ; then - libDir="lib/asan" - fi - echo "$libDir" -} - -# Hardcoding the default GPU_ARCH, but this will be overwritten by input from job param or by component build script -GFX_ARCH="gfx908;gfx90a:xnack-;gfx90a:xnack+;gfx1030;gfx1100;gfx1101;gfx1102;gfx942:xnack-;gfx942:xnack+;gfx1200;gfx1201" -if [ "${ENABLE_ADDRESS_SANITIZER}" == "true" ] ; then - # updating Default GPU_ARCHS for ASAN builds - GFX_ARCH="gfx90a:xnack+;gfx942:xnack+" -fi -# if ENABLE_GPU_ARCH Job parameter is set, then set GFX_ARCH to that value -if [ -n "$ENABLE_GPU_ARCH" ]; then - GFX_ARCH="$ENABLE_GPU_ARCH" -fi -# Finally overwrite the GPU_ARCH with the value from the component build script, if set_gpu_arch is called -# We need to make sure where set_gpu_arch is called in the component build script, -# it should have if condition to check if GPU_ARCH is set by ENABLE_GPU_ARCH, so JOB LEVEL PARAM will have highest priority -set_gpu_arch(){ - GFX_ARCH="$1" -} - -disable_debug_package_generation(){ - SET_DWARF_VERSION_4="" - DISABLE_DEBUG_PACKAGE="true" -} - -# Populate the common cmake params -rocm_math_common_cmake_params=() -init_rocm_common_cmake_params(){ - local retCmakeParams=${1:-rocm_math_common_cmake_params} - local SET_BUILD_TYPE=${BUILD_TYPE:-'RelWithDebInfo'} - local ASAN_LIBDIR="lib/asan" - local CMAKE_PATH=$(getCmakePath) -# Common cmake parameters can be set -# component build scripts can use this function - local cmake_params - if [ "${ASAN_CMAKE_PARAMS}" == "true" ] ; then - cmake_params=( - "-DCMAKE_PREFIX_PATH=$CMAKE_PATH;${ROCM_PATH}/$ASAN_LIBDIR;$ROCM_PATH/llvm;$ROCM_PATH" - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_ASAN_LIB_RPATH" - "-DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_ASAN_EXE_RPATH" - "-DENABLE_ASAN_PACKAGING=true" - ) - else - cmake_params=( - "-DCMAKE_PREFIX_PATH=${ROCM_PATH}/llvm;${ROCM_PATH}" - "-DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_LIB_RPATH" - "-DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ROCM_EXE_RPATH" - ) - fi - - cmake_params+=( - "-DCMAKE_VERBOSE_MAKEFILE=1" - "-DCMAKE_BUILD_TYPE=${SET_BUILD_TYPE}" - "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE" - "-DCMAKE_INSTALL_PREFIX=${ROCM_PATH}" - "-DCMAKE_PACKAGING_INSTALL_PREFIX=${ROCM_PATH}" - "-DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF" - "-DROCM_SYMLINK_LIBS=OFF" - "-DCPACK_PACKAGING_INSTALL_PREFIX=${ROCM_PATH}" - "-DROCM_DISABLE_LDCONFIG=ON" - "-DCPACK_SET_DESTDIR=OFF" - "-DCPACK_RPM_PACKAGE_RELOCATABLE=ON" - "-DROCM_PATH=${ROCM_PATH}" - ) - #rocWMMa does not support gfx1030, so removing from default - if [ "${COMPONENT_SRC}" == "$LIBS_WORK_DIR/rocWMMA" ]; then - GFX_ARCH=$(echo $GFX_ARCH | sed 's/\(gfx1030;\)//g') - fi - #if component is not composable_kernel then only add -DAMDGPU_TARGETS, this is not supported for CK along with -DINSTANCES_ONLY - if [ "${COMPONENT_SRC}" != "$LIBS_WORK_DIR/composable_kernel" ]; then - cmake_params+=( - "-DAMDGPU_TARGETS=${GFX_ARCH}" - ) - fi - - #if component is not hipsparselt | hipblaslt | rocBLAS | composable_kernel, then only add below cmake params. as GPU_TARGETS and CMAKE_HIP_ARCHITECTURES are not supported for hipsparselt, hipblaslt and rocblas - # in future after SWDEV-468293, below params is not needed for any component - case "${COMPONENT_SRC}" in - "${LIBS_WORK_DIR}/hipSPARSELt" | "${LIBS_WORK_DIR}/hipBLASLt" | "${LIBS_WORK_DIR}/rocBLAS" | "${LIBS_WORK_DIR}/composable_kernel") - # Do nothing for these components - ;; - *) - cmake_params+=( - "-DGPU_TARGETS=${GFX_ARCH}" - "-DCMAKE_HIP_ARCHITECTURES=${GFX_ARCH}" - ) - ;; - esac - #TODO :remove if clause once debug related issues are fixed - if [ "${DISABLE_DEBUG_PACKAGE}" == "true" ] ; then - SET_BUILD_TYPE=Release - cmake_params+=( - "-DCPACK_DEBIAN_DEBUGINFO_PACKAGE=FALSE" - "-DCPACK_RPM_DEBUGINFO_PACKAGE=FALSE" - "-DCPACK_RPM_INSTALL_WITH_EXEC=FALSE" - "-DCMAKE_BUILD_TYPE=${SET_BUILD_TYPE}" - ) - elif [ "$SET_BUILD_TYPE" == "RelWithDebInfo" ] || [ "$SET_BUILD_TYPE" == "Debug" ]; then - # RelWithDebinfo optimization level -O2 is having performance impact - # So overriding the same to -O3 - set_gdwarf_4 - cmake_params+=( - "-DCPACK_DEBIAN_DEBUGINFO_PACKAGE=TRUE" - "-DCPACK_RPM_DEBUGINFO_PACKAGE=TRUE" - "-DCPACK_RPM_INSTALL_WITH_EXEC=TRUE" - "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${SET_DWARF_VERSION_4} -O3 -g -DNDEBUG" - ) - fi - eval "${retCmakeParams}=( \"\${cmake_params[@]}\" ) " -} - -# Setup a number of variables to specify where to find the source -# where to do the build and where to put the packages -# Note the PACKAGE_DIR downcases the package name -# This could be extended to do different things based on $1 -set_component_src(){ - COMPONENT_SRC="$LIBS_WORK_DIR/$1" - - BUILD_DIR="$OUT_DIR/build/$1" - DEB_PATH="$OUT_DIR/${PKGTYPE}/${1,,}" - RPM_PATH="$OUT_DIR/${PKGTYPE}/${1,,}" - PACKAGE_DIR="$OUT_DIR/${PKGTYPE}/${1,,}" -} - -# Standard definition of function to print the package location. If -# for some reason a custom version is needed then it can overwrite -# this definition -# TODO: Don't use a global PKGTYPE, pass the value in as a parameter -print_output_directory() { - case ${1:-$PKGTYPE} in - ("deb") - echo ${DEB_PATH};; - ("rpm") - echo ${RPM_PATH};; - (*) - echo "Invalid package type \"${PKGTYPE}\" provided for -o" >&2; exit 1;; - esac - exit -} - -# Standard argument processing -# Here to avoid repetition -TARGET="build" # default target -stage2_command_args(){ - while [ "$1" != "" ]; - do - case $1 in - -o | --outdir ) - shift 1; PKGTYPE=$1 ; TARGET="outdir" ;; - -c | --clean ) - TARGET="clean" ;; - *) - break ;; - esac - shift 1 - done -} - -show_build_cache_stats(){ - if [ "$CCACHE_ENABLED" = "true" ] ; then - if ! ccache -s; then - echo "Unable to display sccache stats" - fi - fi -} diff --git a/tools/rocm-build/docker/ubuntu22/Dockerfile b/tools/rocm-build/docker/ubuntu22/Dockerfile deleted file mode 100644 index 45a602f74..000000000 --- a/tools/rocm-build/docker/ubuntu22/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:jammy as builder -COPY packages /tmp/packages -COPY local-pin-600 /tmp/local-pin-600 -COPY install-prerequisities.sh /tmp/install-prerequisities.sh -RUN chmod +x /tmp/install-prerequisities.sh -ENV KBUILD_PKG_ROOTCMD= -ENV RPP_DEPS_LOCATION=/usr/local/rpp-deps -RUN /tmp/install-prerequisities.sh -WORKDIR /src diff --git a/tools/rocm-build/docker/ubuntu22/README.md b/tools/rocm-build/docker/ubuntu22/README.md deleted file mode 100644 index 7aee1f178..000000000 --- a/tools/rocm-build/docker/ubuntu22/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Steps to build the Docker Image - -1. Clone this repository. - - ```bash - git clone https://github.com/ROCm/rocm-build.git - ``` - -2. Go into the OS-specific Docker directory in build-infra. - - ```bash - cd rocm-build/build/docker/ubuntu22 - ``` - -3. Build the Docker image - - ```bash - docker build -t . - ``` - - Replace the `` with a new Docker image name of your choice. - -4. After successful build, check that your \ exist in the list of available Docker images. - - ```bash - docker images - ``` diff --git a/tools/rocm-build/docker/ubuntu22/install-prerequisites.sh b/tools/rocm-build/docker/ubuntu22/install-prerequisites.sh deleted file mode 100644 index 1d6605efe..000000000 --- a/tools/rocm-build/docker/ubuntu22/install-prerequisites.sh +++ /dev/null @@ -1,324 +0,0 @@ -#! /usr/bin/bash - -set -ex - -apt-get -y update -DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install --no-install-recommends -y $(sed 's/#.*//' /tmp/packages) -apt-get clean -rm -rf /var/cache/apt/ /var/lib/apt/lists/* /etc/apt/apt.conf.d/01proxy - -#Install 2.17.1 version of git as we are seeing issues with 2.25 , where it was not allowing to add git submodules if the user is different for parent git directory -curl -o git.tar.gz https://cdn.kernel.org/pub/software/scm/git/git-2.17.1.tar.gz -tar -zxf git.tar.gz -cd git-* -make prefix=/usr/local all -make prefix=/usr/local install -git --version - -#install argparse and CppHeaderParser python modules for roctracer and rocprofiler -#install rocm-docs-core for the docs-as-code project. Only needed on one OS -# CppHeader needs setuptools. setuptools needs wheel. -# Looks like I need them as seperate commands -# Sigh, install both python2 and python 3 version -pip3 install --no-cache-dir setuptools wheel tox -pip3 install --no-cache-dir CppHeaderParser argparse requests lxml barectf recommonmark jinja2==3.0.0 \ - websockets matplotlib numpy==1.26.4 scipy minimal msgpack pytest sphinx joblib PyYAML rocm-docs-core cmake==3.25.2 pandas myst-parser lit - -# Allow sudo for everyone user -echo 'ALL ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/everyone - -#Install libva-amdgpu-dev libdrm-amdgpu-dev -wget https://repo.radeon.com/amdgpu-install/6.3/ubuntu/jammy/amdgpu-install_6.3.60300-1_all.deb -apt install -y ./amdgpu-install_6.3.60300-1_all.deb -apt update -apt install -y libva-amdgpu-dev libdrm-amdgpu-dev -rm -rf /etc/apt/sources.list.d/amdgpu.list /etc/apt/sources.list.d/amdgpu-proprietary.list ./amdgpu-install_6.3.60300-1_all.deb -apt autoremove -y --purge amdgpu-install -apt update - -# Install OCaml packages to build LLVM's OCaml bindings to be used in lightning compiler test pipeline -wget -nv https://sourceforge.net/projects/opam.mirror/files/2.1.6/opam-2.1.6-x86_64-linux/download -O /usr/local/bin/opam -chmod +x /usr/local/bin/opam -opam init --yes --disable-sandboxing -opam install ctypes --yes - -# Install and modify git-repo (#!/usr/bin/env python -> #!/usr/bin/env python3) -curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo -chmod a+x /usr/bin/repo - - -# Install sharp from MLNX_OFED_LINUX as dependency for rccl-rdma-sharp-plugins -cd /var/tmp -mkdir mlnx -wget -O mlnx/tar.tgz https://content.mellanox.com/ofed/MLNX_OFED-24.01-0.3.3.1/MLNX_OFED_LINUX-24.01-0.3.3.1-ubuntu22.04-x86_64.tgz -tar -xz -C mlnx -f mlnx/tar.tgz -apt-key add mlnx/*/RPM-GPG-KEY-Mellanox -echo "deb [arch=amd64] file:$(echo $PWD/mlnx/*/DEBS) ./" > /etc/apt/sources.list.d/sharp.list -apt update -apt install -y sharp -apt clean -rm -rf /var/cache/apt/ /var/lib/apt/lists/* mlnx /etc/apt/sources.list.d/sharp.list - -apt update -apt -y install libunwind-dev -apt -y install libgoogle-glog-dev; - -# Install python3.8 from source -curl -LO https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tar.xz -tar -xvf Python-3.8.13.tar.xz -pwd -ls /var/tmp/ -ls Python-3.8.13 -mv Python-3.8.13 /opt/ -apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev pkg-config make -y -cd /opt/Python-3.8.13/ -./configure --enable-optimizations --enable-shared -make -make -j 6 -make altinstall -ldconfig /opt/Python3.8.13 -python3.8 --version - -# roctracer and rocprofiler needs this python3.8 -python3.8 -m pip install setuptools wheel -python3.8 -m pip install CppHeaderParser argparse requests lxml PyYAML joblib - - -#Install older version of hwloc-devel package for rocrtst -curl -lO https://download.open-mpi.org/release/hwloc/v1.11/hwloc-1.11.13.tar.bz2 -tar -xvf hwloc-1.11.13.tar.bz2 -cd hwloc-1.11.13 -./configure -make -make install -cp /usr/local/lib/libhwloc.so.5 /usr/lib -hwloc-info --version - -# Install gtest -mkdir -p /tmp/gtest -cd /tmp/gtest -wget https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip -O googletest.zip -unzip googletest.zip -cd googletest-1.14.0/ -mkdir build -cd build -cmake .. -make -j$(nproc) -make install -rm -rf /tmp/gtest - -## Install gRPC from source -## RDC Pre-requisites -mkdir /tmp/grpc -mkdir /usr/grpc -cd /tmp -git clone --recurse-submodules -b v1.67.1 https://github.com/grpc/grpc -cd grpc -mkdir -p build -cd build -cmake -DgRPC_INSTALL=ON -DBUILD_SHARED_LIBS=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/grpc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,'$ORIGIN' .. -make -j $(nproc) install -rm -rf /tmp/grpc - -## Download prebuilt AMD multithreaded blis (2.0) -## Reference : https://github.com/ROCmSoftwarePlatform/rocBLAS/blob/develop/install.sh#L403 -mkdir -p /tmp/blis -cd /tmp/blis -wget -O - https://github.com/amd/blis/releases/download/2.0/aocl-blis-mt-ubuntu-2.0.tar.gz | tar xfz - -mv amd-blis-mt /usr/blis -cd / -rm -rf /tmp/blis - -## rocBLAS Pre-requisites -## Download aocl-linux-gcc-4.2.0_1_amd64.deb -mkdir -p /tmp/aocl -cd /tmp/aocl -wget -nv https://download.amd.com/developer/eula/aocl/aocl-4-2/aocl-linux-gcc-4.2.0_1_amd64.deb -apt install ./aocl-linux-gcc-4.2.0_1_amd64.deb -rm -rf /tmp/aocl - -## hipBLAS Pre-requisites -## lapack(3.9.1v) -## Reference https://github.com/ROCmSoftwarePlatform/rocSOLVER/blob/develop/install.sh#L174 -lapack_version=3.9.1 -lapack_srcdir=lapack-$lapack_version -lapack_blddir=lapack-$lapack_version-bld -mkdir -p /tmp/lapack -cd /tmp/lapack -rm -rf "$lapack_srcdir" "$lapack_blddir" -wget -O - https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.9.1.tar.gz | tar xzf - -cmake -H$lapack_srcdir -B$lapack_blddir -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_FLAGS=-fno-optimize-sibling-calls -DBUILD_TESTING=OFF -DCBLAS=ON -DLAPACKE=OFF -make -j$(nproc) -C "$lapack_blddir" -make -C "$lapack_blddir" install -cd $lapack_blddir -cp -r ./include/* /usr/local/include/ -cp -r ./lib/* /usr/local/lib -cd / -rm -rf /tmp/lapack - -## rocSOLVER Pre-requisites -## FMT(7.1.3v) -## Reference https://github.com/ROCmSoftwarePlatform/rocSOLVER/blob/develop/install.sh#L152 -fmt_version=7.1.3 -fmt_srcdir=fmt-$fmt_version -fmt_blddir=fmt-$fmt_version-bld -mkdir -p /tmp/fmt -cd /tmp/fmt -rm -rf "$fmt_srcdir" "$fmt_blddir" -wget -O - https://github.com/fmtlib/fmt/archive/refs/tags/7.1.3.tar.gz | tar xzf - -cmake -H$fmt_srcdir -B$fmt_blddir -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_STANDARD_REQUIRED=ON -DFMT_DOC=OFF -DFMT_TEST=OFF -make -j$(nproc) -C "$fmt_blddir" -make -C "$fmt_blddir" install - -# Build and install libjpeg-turbo -mkdir -p /tmp/libjpeg-turbo -cd /tmp/libjpeg-turbo -wget -nv https://github.com/rrawther/libjpeg-turbo/archive/refs/heads/2.0.6.2.zip -O libjpeg-turbo-2.0.6.2.zip -unzip libjpeg-turbo-2.0.6.2.zip -cd libjpeg-turbo-2.0.6.2 -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib .. -make -j$(nproc) install -rm -rf /tmp/libjpeg-turbo - -# Get released ninja from source -mkdir -p /tmp/ninja -cd /tmp/ninja -wget -nv https://codeload.github.com/Kitware/ninja/zip/refs/tags/v1.11.1.g95dee.kitware.jobserver-1 -O ninja.zip -unzip ninja.zip -cd ninja-1.11.1.g95dee.kitware.jobserver-1 -./configure.py --bootstrap -cp ninja /usr/local/bin/ -rm -rf /tmp/ninja - -# Install FFmpeg and dependencies -apt-get update -apt-get install --no-install-recommends -y ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev - -# Build NASM -mkdir -p /tmp/nasm-2.15.05 -cd /tmp -wget -qO- "https://distfiles.macports.org/nasm/nasm-2.15.05.tar.bz2" | tar -xvj -cd nasm-2.15.05 -./autogen.sh -./configure --prefix="/usr/local" -make -j$(nproc) install -rm -rf /tmp/nasm-2.15.05 - -# Build YASM -mkdir -p /tmp/yasm-1.3.0 -cd /tmp -wget -qO- "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" | tar -xvz -cd yasm-1.3.0 -./configure --prefix="/usr/local" -make -j$(nproc) install -rm -rf /tmp/yasm-1.3.0 - -# Build x264 -mkdir -p /tmp/x264-snapshot-20191217-2245-stable -cd /tmp -wget -qO- "https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20191217-2245-stable.tar.bz2" | tar -xvj -cd /tmp/x264-snapshot-20191217-2245-stable -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --prefix="/usr/local" --enable-shared -make -j$(nproc) install -rm -rf /tmp/x264-snapshot-20191217-2245-stable - -# Build x265 -mkdir -p /tmp/x265_2.7 -cd /tmp -wget -qO- "https://get.videolan.org/x265/x265_2.7.tar.gz" | tar -xvz -cd /tmp/x265_2.7/build/linux -cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" -DENABLE_SHARED:bool=on ../../source -make -j$(nproc) install -rm -rf /tmp/x265_2.7 - -# Build fdk-aac -mkdir -p /tmp/fdk-aac-2.0.2 -cd /tmp -wget -qO- "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.2.tar.gz" | tar -xvz -cd /tmp/fdk-aac-2.0.2 -autoreconf -fiv -./configure --prefix="/usr/local" --enable-shared --disable-static -make -j$(nproc) install -rm -rf /tmp/fdk-aac-2.0.2 - -cp /tmp/local-pin-600 /etc/apt/preferences.d - -command -v lbzip2 -ln -sf $(command -v lbzip2) /usr/local/bin/compressor || ln -sf $(command -v bzip2) /usr/local/bin/compressor - -# Install Google Benchmark -mkdir -p /tmp/Gbenchmark -cd /tmp/Gbenchmark -wget -qO- https://github.com/google/benchmark/archive/refs/tags/v1.6.1.tar.gz | tar xz -cmake -Sbenchmark-1.6.1 -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_CXX_STANDARD=14 -make -j -C build -cd /tmp/Gbenchmark/build -make install - -# Build boost-1.85.0 from source for RPP -# Installing in a non-standard location since the test packages of hipFFT and rocFFT pick up the version of -# the installed Boost library and declare a package dependency on that specific version of Boost. -# For example, if this was installed in the standard location it would declare a dependency on libboost-dev(el)1.85.0 -# which is not available as a package in any distro. -# Once this is fixed, we can remove the Boost package from the requirements list and install this -# in the standard location -mkdir -p /tmp/boost-1.85.0 -cd /tmp/boost-1.85.0 -wget -nv https://sourceforge.net/projects/boost/files/boost/1.85.0/boost_1_85_0.tar.bz2 -O ./boost_1_85_0.tar.bz2 -tar -xf boost_1_85_0.tar.bz2 --use-compress-program="/usr/local/bin/compressor" -cd boost_1_85_0 -./bootstrap.sh --prefix=${RPP_DEPS_LOCATION} --with-python=python3 -./b2 stage -j$(nproc) threading=multi link=shared cxxflags="-std=c++11" -./b2 install threading=multi link=shared --with-system --with-filesystem -./b2 stage -j$(nproc) threading=multi link=static cxxflags="-std=c++11 -fpic" cflags="-fpic" -./b2 install threading=multi link=static --with-system --with-filesystem -rm -rf /tmp/boost-1.85.0 - -# Build ccache from the source -cd /tmp -git clone https://github.com/ccache/ccache -b v4.7.5 -cd ccache -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make -make install -cd /tmp -rm -rf ccache - -# symlinks for ccache -ln -s /usr/local/bin/ccache /usr/local/bin/gcc -ln -s /usr/local/bin/ccache /usr/local/bin/g++ -ln -s /usr/local/bin/ccache /usr/local/bin/cc -ln -s /usr/local/bin/ccache /usr/local/bin/c++ -ln -s /usr/local/bin/ccache /usr/local/bin/amdclang -ln -s /usr/local/bin/ccache /usr/local/bin/amdclang++ -ln -s /usr/local/bin/ccache /usr/local/bin/hipcc - -# Installing MIOpen dependencies -pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz -mkdir -p /tmp/MIOpen -git clone https://github.com/ROCm/MIOpen.git -b amd-master /tmp/MIOpen -cd /tmp/MIOpen -# Commenting rocMLIR and componsable kernel components to install thirt party dependences -sed -i '/ROCm\/rocMLIR@\|ROCm\/composable_kernel@/s/^/#/' requirements.txt -mkdir -p /tmp/miopen-deps -rbuild prepare -d /tmp/miopen-deps/ --cxx /usr/bin/g++ --cc /usr/bin/gcc -# Installing rocMLIR which is a depency for MIOPEN. Please not we are not installing CK -# explicitly its already build as part of rocm stack. -export PROC=${PROC:-"$(nproc)"} -MLIR_COMMIT="$(awk '/rocMLIR/ {split($1, s, "@"); print s[2]}' requirements.txt)" -mkdir -p /tmp/rocMLIR -cd /tmp/rocMLIR -wget -nv "https://www.github.com/ROCmSoftwarePlatform/rocMLIR/archive/${MLIR_COMMIT}.tar.gz" -tar -xzf "${MLIR_COMMIT}.tar.gz" -cd "rocMLIR-${MLIR_COMMIT}" -mkdir build -cd build -cmake -G Ninja -DCMAKE_C_COMPILER="/usr/bin/gcc" -DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/tmp/miopen-deps" -DBUILD_FAT_LIBROCKCOMPILER=1 .. -cmake --build . -- librockCompiler -cmake --build . -- install -rm -rf _CPack_Packages/ /tmp/MIOpen /tmp/rocMLIR -find -name '*.o' -delete diff --git a/tools/rocm-build/docker/ubuntu22/local-pin-600 b/tools/rocm-build/docker/ubuntu22/local-pin-600 deleted file mode 100644 index 4282294af..000000000 --- a/tools/rocm-build/docker/ubuntu22/local-pin-600 +++ /dev/null @@ -1,3 +0,0 @@ -Package: * -Pin: origin "" -Pin-Priority: 600 \ No newline at end of file diff --git a/tools/rocm-build/docker/ubuntu22/packages b/tools/rocm-build/docker/ubuntu22/packages deleted file mode 100644 index 06f01892c..000000000 --- a/tools/rocm-build/docker/ubuntu22/packages +++ /dev/null @@ -1,135 +0,0 @@ -apt-utils -aria2 -autoconf -automake -bc -bison -bridge-utils -build-essential -bzip2 -check -chrpath -cifs-utils -cpio -curl -devscripts -dkms -dos2unix -fakeroot -flex -freeglut3-dev -g++ -g++-multilib -gawk -gcc -gcc-multilib -gfortran -git-lfs -gnupg -graphviz -kernel-wedge -lbzip2 -# less is needed by repo -less -libass-dev -libatlas-base-dev -libbabeltrace-ctf-dev -libbabeltrace-dev -libboost-all-dev -libboost-dev -libboost-filesystem-dev -libboost-program-options-dev -libboost-system-dev -libbz2-dev -libc++-dev -libc++1 -libc++abi-dev -libc++abi1 -libc6-dev-i386 -libcap-dev -libcurl4-openssl-dev -libdrm-dev -libdw-dev -libdw1 -libdwarf-dev -libelf-dev -libelf1 -libexpat1-dev -libfftw3-dev -libfile-find-rule-perl -libgflags-dev -libglew-dev -libgmp-dev -libgtk2.0-dev -libhdf5-serial-dev -libjpeg-dev -libleveldb-dev -liblmdb-dev -liblzma-dev -libmpfr-dev -libmpich-dev -libmsgpack-dev -libncurses5-dev -libnuma-dev -libomp-dev -libopenblas-base -libopenblas-dev -libopencv-dev -libpci-dev -libpci3 -libpciaccess-dev -libpciaccess0 -libprotobuf-dev -libpython2.7-dev -libpython3-dev -libreadline-dev -libsnappy-dev -libssl-dev -libsuitesparse-dev -libsystemd-dev -libtinfo-dev -libtool -liburi-encode-perl -libva-dev -libvirt-clients -libvirt-daemon-system -libyaml-cpp-dev -libzstd-dev -llvm -llvm-dev -llvm-runtime -mesa-common-dev -mpich -ocaml -ocaml-findlib -ocl-icd-libopencl1 -ocl-icd-opencl-dev -patchelf -pigz -pkg-config -protobuf-compiler -python-is-python3 -python3-pip-whl -python3-dev -python3-pip -python3-venv -python3-yaml -python3.8-dev -re2c -redis-tools -rpm -rsync -ssh -strace -sudo -systemtap-sdt-dev -texinfo -texlive -texlive-extra-utils -texlive-plain-generic -texlive-xetex -unzip -vim -wget -xsltproc -zlib1g-dev diff --git a/tools/rocm-build/docker/ubuntu24/Dockerfile b/tools/rocm-build/docker/ubuntu24/Dockerfile deleted file mode 100644 index d23d420a1..000000000 --- a/tools/rocm-build/docker/ubuntu24/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:noble as builder -COPY packages /tmp/packages -COPY local-pin-600 /tmp/local-pin-600 -COPY install-prerequisities.sh /tmp/install-prerequisities.sh -RUN chmod +x /tmp/install-prerequisities.sh -ENV KBUILD_PKG_ROOTCMD= -ENV RPP_DEPS_LOCATION=/usr/local/rpp-deps -ENV PATH="/opt/venv/bin:$PATH" -ENV PATH=$PATH:"/usr/local/bin" -RUN /tmp/install-prerequisities.sh -WORKDIR /src diff --git a/tools/rocm-build/docker/ubuntu24/README.md b/tools/rocm-build/docker/ubuntu24/README.md deleted file mode 100644 index 7aee1f178..000000000 --- a/tools/rocm-build/docker/ubuntu24/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Steps to build the Docker Image - -1. Clone this repository. - - ```bash - git clone https://github.com/ROCm/rocm-build.git - ``` - -2. Go into the OS-specific Docker directory in build-infra. - - ```bash - cd rocm-build/build/docker/ubuntu22 - ``` - -3. Build the Docker image - - ```bash - docker build -t . - ``` - - Replace the `` with a new Docker image name of your choice. - -4. After successful build, check that your \ exist in the list of available Docker images. - - ```bash - docker images - ``` diff --git a/tools/rocm-build/docker/ubuntu24/install-prerequisites.sh b/tools/rocm-build/docker/ubuntu24/install-prerequisites.sh deleted file mode 100644 index 28f50efae..000000000 --- a/tools/rocm-build/docker/ubuntu24/install-prerequisites.sh +++ /dev/null @@ -1,265 +0,0 @@ -#! /usr/bin/bash - -set -ex - -apt-get update -DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install --no-install-recommends -y $(sed 's/#.*//' /tmp/packages) -apt-get clean -rm -rf /var/cache/apt/ /var/lib/apt/lists/* /etc/apt/apt.conf.d/01proxy - -#Install 2.17.1 version of git as we are seeing issues with 2.25 , where it was not allowing to add git submodules if the user is different for parent git directory -curl -o git.tar.gz https://cdn.kernel.org/pub/software/scm/git/git-2.17.1.tar.gz -tar -zxf git.tar.gz -cd git-* -make prefix=/usr/local all -make prefix=/usr/local install -git --version - -# venv for python to be able to run pip3 without --break-system-packages -python3 -m venv /opt/venv -source /opt/venv/bin/activate -pip3 install CppHeaderParser argparse lxml recommonmark jinja2==3.0.0 \ - websockets matplotlib numpy scipy minimal msgpack pytest sphinx joblib PyYAML rocm-docs-core cmake==3.25.2 pandas \ - myst-parser setuptools lit - -# Allow sudo for everyone user -echo 'ALL ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/everyone - -wget https://repo.radeon.com/amdgpu-install/6.3/ubuntu/noble/amdgpu-install_6.3.60300-1_all.deb -apt install -y ./amdgpu-install_6.3.60300-1_all.deb -apt update -apt install -y libva-amdgpu-dev libdrm-amdgpu-dev -rm -rf /etc/apt/sources.list.d/amdgpu.list /etc/apt/sources.list.d/amdgpu-proprietary.list ./amdgpu-install_6.3.60300-1_all.deb -apt autoremove -y --purge amdgpu-install -apt update - - -# Install OCaml packages to build LLVM's OCaml bindings to be used in lightning compiler test pipeline -wget -nv https://sourceforge.net/projects/opam.mirror/files/2.1.6/opam-2.1.6-x86_64-linux/download -O /usr/local/bin/opam -chmod +x /usr/local/bin/opam -opam init --yes --disable-sandboxing -opam install ctypes --yes - -# Install and modify git-repo (#!/usr/bin/env python -> #!/usr/bin/env python3) -curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo -chmod a+x /usr/bin/repo - -#Install older version of hwloc-devel package for rocrtst -curl -lO https://download.open-mpi.org/release/hwloc/v1.11/hwloc-1.11.13.tar.bz2 -tar -xvf hwloc-1.11.13.tar.bz2 -cd hwloc-1.11.13 -./configure -make -make install -cp /usr/local/lib/libhwloc.so.5 /usr/lib -hwloc-info --version - -# Install gtest -mkdir -p /tmp/gtest -cd /tmp/gtest -wget https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip -O googletest.zip -unzip googletest.zip -cd googletest-1.14.0/ -mkdir build -cd build -cmake .. -make -j$(nproc) -make install -rm -rf /tmp/gtest - -## Install gRPC from source -## RDC Pre-requisites -mkdir /tmp/grpc -mkdir /usr/grpc -cd /tmp -git clone --recurse-submodules -b v1.67.1 https://github.com/grpc/grpc -cd grpc -mkdir -p build -cd build -cmake -DgRPC_INSTALL=ON -DBUILD_SHARED_LIBS=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/grpc -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 .. -make -j $(nproc) install -rm -rf /tmp/grpc - -### rocBLAS Pre-requisites -## Download prebuilt AMD multithreaded blis (2.0) -## Reference : https://github.com/ROCmSoftwarePlatform/rocBLAS/blob/develop/install.sh#L403 -mkdir -p /tmp/blis -cd /tmp/blis -wget -O - https://github.com/amd/blis/releases/download/2.0/aocl-blis-mt-ubuntu-2.0.tar.gz | tar xfz - -mv amd-blis-mt /usr/blis -cd / -rm -rf /tmp/blis - -## Download aocl-linux-aocc-4.0_1_amd64 -mkdir -p /tmp/aocl -cd /tmp/aocl -wget -nv https://download.amd.com/developer/eula/aocl/aocl-4-0/aocl-linux-aocc-4.0_1_amd64.deb -apt install ./aocl-linux-aocc-4.0_1_amd64.deb -rm -rf /tmp/aocl - -## hipBLAS Pre-requisites -## lapack(3.9.1v) -## Reference https://github.com/ROCmSoftwarePlatform/rocSOLVER/blob/develop/install.sh#L174 -lapack_version=3.9.1 -lapack_srcdir=lapack-$lapack_version -lapack_blddir=lapack-$lapack_version-bld -mkdir -p /tmp/lapack -cd /tmp/lapack -rm -rf "$lapack_srcdir" "$lapack_blddir" -wget -O - https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.9.1.tar.gz | tar xzf - -cmake -H$lapack_srcdir -B$lapack_blddir -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_FLAGS=-fno-optimize-sibling-calls -DBUILD_TESTING=OFF -DCBLAS=ON -DLAPACKE=OFF -make -j$(nproc) -C "$lapack_blddir" -make -C "$lapack_blddir" install -cd $lapack_blddir -cp -r ./include/* /usr/local/include/ -cp -r ./lib/* /usr/local/lib -cd / -rm -rf /tmp/lapack - -# rocSOLVER Pre-requisites -## FMT(7.1.3v) -## Reference https://github.com/ROCmSoftwarePlatform/rocSOLVER/blob/develop/install.sh#L152 -fmt_version=7.1.3 -fmt_srcdir=fmt-$fmt_version -fmt_blddir=fmt-$fmt_version-bld -mkdir -p /tmp/fmt -cd /tmp/fmt -rm -rf "$fmt_srcdir" "$fmt_blddir" -wget -O - https://github.com/fmtlib/fmt/archive/refs/tags/7.1.3.tar.gz | tar xzf - -cmake -H$fmt_srcdir -B$fmt_blddir -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_CXX_STANDARD_REQUIRED=ON -DFMT_DOC=OFF -DFMT_TEST=OFF -make -j$(nproc) -C "$fmt_blddir" -make -C "$fmt_blddir" install - -# Build and install libjpeg-turbo -mkdir -p /tmp/libjpeg-turbo -cd /tmp/libjpeg-turbo -wget -nv https://github.com/rrawther/libjpeg-turbo/archive/refs/heads/2.0.6.2.zip -O libjpeg-turbo-2.0.6.2.zip -unzip libjpeg-turbo-2.0.6.2.zip -cd libjpeg-turbo-2.0.6.2 -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_STATIC=FALSE -DCMAKE_INSTALL_DEFAULT_LIBDIR=lib .. -make -j$(nproc) install -rm -rf /tmp/libjpeg-turbo - -# Get released ninja from source -mkdir -p /tmp/ninja -cd /tmp/ninja -wget -nv https://codeload.github.com/Kitware/ninja/zip/refs/tags/v1.11.1.g95dee.kitware.jobserver-1 -O ninja.zip -unzip ninja.zip -cd ninja-1.11.1.g95dee.kitware.jobserver-1 -./configure.py --bootstrap -cp ninja /usr/local/bin/ -rm -rf /tmp/ninja - -# Install FFmpeg and dependencies -apt-get update -apt-get install --no-install-recommends -y ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev - -# Build NASM -mkdir -p /tmp/nasm-2.15.05 -cd /tmp -wget -qO- "https://distfiles.macports.org/nasm/nasm-2.15.05.tar.bz2" | tar -xvj -cd nasm-2.15.05 -./autogen.sh -./configure --prefix="/usr/local" -make -j$(nproc) install -rm -rf /tmp/nasm-2.15.05 - -# Build YASM -mkdir -p /tmp/yasm-1.3.0 -cd /tmp -wget -qO- "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" | tar -xvz -cd yasm-1.3.0 -./configure --prefix="/usr/local" -make -j$(nproc) install -rm -rf /tmp/yasm-1.3.0 - -# Build x264 -mkdir -p /tmp/x264-snapshot-20191217-2245-stable -cd /tmp -wget -qO- "https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20191217-2245-stable.tar.bz2" | tar -xvj -cd /tmp/x264-snapshot-20191217-2245-stable -PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure --prefix="/usr/local" --enable-shared -make -j$(nproc) install -rm -rf /tmp/x264-snapshot-20191217-2245-stable - -# Build x265 -mkdir -p /tmp/x265_2.7 -cd /tmp -wget -qO- "https://get.videolan.org/x265/x265_2.7.tar.gz" | tar -xvz -cd /tmp/x265_2.7/build/linux -cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" -DENABLE_SHARED:bool=on ../../source -make -j$(nproc) install -rm -rf /tmp/x265_2.7 - -# Build fdk-aac -mkdir -p /tmp/fdk-aac-2.0.2 -cd /tmp -wget -qO- "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.2.tar.gz" | tar -xvz -cd /tmp/fdk-aac-2.0.2 -autoreconf -fiv -./configure --prefix="/usr/local" --enable-shared --disable-static -make -j$(nproc) install -rm -rf /tmp/fdk-aac-2.0.2 - -cp /tmp/local-pin-600 /etc/apt/preferences.d - -command -v lbzip2 -ln -sf $(command -v lbzip2) /usr/local/bin/compressor || ln -sf $(command -v bzip2) /usr/local/bin/compressor - -# Install Google Benchmark -mkdir -p /tmp/Gbenchmark -cd /tmp/Gbenchmark -wget -qO- https://github.com/google/benchmark/archive/refs/tags/v1.6.1.tar.gz | tar xz -cmake -Sbenchmark-1.6.1 -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_CXX_STANDARD=14 -make -j -C build -cd /tmp/Gbenchmark/build -make install - -# Build ccache from the source -cd /tmp -git clone https://github.com/ccache/ccache -b v4.7.5 -cd ccache -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make -make install -cd /tmp -rm -rf ccache - -# symlinks for ccache -ln -s /usr/local/bin/ccache /usr/local/bin/gcc -ln -s /usr/local/bin/ccache /usr/local/bin/g++ -ln -s /usr/local/bin/ccache /usr/local/bin/cc -ln -s /usr/local/bin/ccache /usr/local/bin/c++ -ln -s /usr/local/bin/ccache /usr/local/bin/amdclang -ln -s /usr/local/bin/ccache /usr/local/bin/amdclang++ -ln -s /usr/local/bin/ccache /usr/local/bin/hipcc - -# Installing MIOpen dependencies -pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz -mkdir -p /tmp/MIOpen -git clone https://github.com/ROCm/MIOpen.git -b amd-master /tmp/MIOpen -cd /tmp/MIOpen -# Commenting rocMLIR and componsable kernel components to install thirt party dependences -sed -i '/ROCm\/rocMLIR@\|ROCm\/composable_kernel@/s/^/#/' requirements.txt -mkdir -p /tmp/miopen-deps -rbuild prepare -d /tmp/miopen-deps/ --cxx /usr/bin/g++ --cc /usr/bin/gcc -# Installing rocMLIR which is a depency for MIOPEN. Please not we are not installing CK -# explicitly its already build as part of rocm stack. -export PROC=${PROC:-"$(nproc)"} -MLIR_COMMIT="$(awk '/rocMLIR/ {split($1, s, "@"); print s[2]}' requirements.txt)" -mkdir -p /tmp/rocMLIR -cd /tmp/rocMLIR -wget -nv "https://www.github.com/ROCmSoftwarePlatform/rocMLIR/archive/${MLIR_COMMIT}.tar.gz" -tar -xzf "${MLIR_COMMIT}.tar.gz" -cd "rocMLIR-${MLIR_COMMIT}" -mkdir build -cd build -cmake -G Ninja -DCMAKE_C_COMPILER="/usr/bin/gcc" -DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/tmp/miopen-deps" -DBUILD_FAT_LIBROCKCOMPILER=1 .. -cmake --build . -- librockCompiler -cmake --build . -- install -rm -rf _CPack_Packages/ /tmp/MIOpen /tmp/rocMLIR -find -name '*.o' -delete diff --git a/tools/rocm-build/docker/ubuntu24/local-pin-600 b/tools/rocm-build/docker/ubuntu24/local-pin-600 deleted file mode 100644 index 8cfa54d34..000000000 --- a/tools/rocm-build/docker/ubuntu24/local-pin-600 +++ /dev/null @@ -1,3 +0,0 @@ -Package: * -Pin: origin "" -Pin-Priority: 600 diff --git a/tools/rocm-build/docker/ubuntu24/packages b/tools/rocm-build/docker/ubuntu24/packages deleted file mode 100644 index c43e14348..000000000 --- a/tools/rocm-build/docker/ubuntu24/packages +++ /dev/null @@ -1,135 +0,0 @@ -apt-utils -aria2 -autoconf -automake -bc -bison -bridge-utils -build-essential -bzip2 -check -chrpath -cifs-utils -cmake -cpio -curl -devscripts -dos2unix -doxygen -fakeroot -flex -freeglut3-dev -g++ -g++-multilib -gawk -gcc -gcc-multilib -gfortran -git-lfs -gnupg -googletest -graphviz -kernel-wedge -kmod -lbzip2 -less -libass-dev -libatlas-base-dev -libbabeltrace-dev -libboost-all-dev -libboost-dev -libboost-filesystem-dev -libboost-program-options-dev -libboost-system-dev -libbz2-dev -libc++-dev -libc++1 -libc++abi-dev -libc++abi1 -libc6-dev-i386 -libcap-dev -libcurl4-openssl-dev -libdrm-dev -libdw-dev -libdw1 -libdwarf-dev -libelf-dev -libelf1 -libexpat1-dev -libfftw3-dev -libfile-find-rule-perl -libgflags-dev -libglew-dev -libgmp-dev -libgoogle-glog-dev -libgtk2.0-dev -libhdf5-dev -libjpeg-dev -libleveldb-dev -liblmdb-dev -liblzma-dev -libmpfr-dev -libmpich-dev -libmsgpack-dev -libncurses-dev -libnuma-dev -libomp-dev -libopenblas-dev -libopencv-dev -libpci-dev -libpci3 -libpciaccess-dev -libpciaccess0 -libprotobuf-dev -libpython3-dev -libreadline-dev -libsnappy-dev -libssl-dev -libsuitesparse-dev -libsystemd-dev -libtool -liburi-encode-perl -libva-dev -libvirt-clients -libvirt-daemon-system -libyaml-cpp-dev -llvm -llvm-dev -llvm-runtime -mesa-common-dev -mpich -ocaml -ocaml-findlib -ocl-icd-libopencl1 -ocl-icd-opencl-dev -patchelf -pigz -pkg-config -protobuf-compiler -python-is-python3 -python3-barectf -python3-dev -python3-pip -python3-pip-whl -python3-requests -python3-venv -python3-yaml -re2c -redis-tools -rpm -rsync -ssh -strace -sudo -systemtap-sdt-dev -texinfo -texlive -texlive-extra-utils -texlive-plain-generic -texlive-xetex -unzip -vim -wget -xsltproc -xxd -zlib1g-dev diff --git a/tools/rocm-build/envsetup.sh b/tools/rocm-build/envsetup.sh deleted file mode 100755 index d67d9f574..000000000 --- a/tools/rocm-build/envsetup.sh +++ /dev/null @@ -1,273 +0,0 @@ -#!/bin/bash - -set_WORK_ROOT(){ - [ -n "$WORK_ROOT" ] && return 0 - export WORK_ROOT=$PWD - while :; do - [ -d "$WORK_ROOT/.repo/manifests" ] && return 0 - WORK_ROOT=$WORK_ROOT/.. - ( cd -P "$WORK_ROOT" && [ "$PWD" != "/" ] ) || break - done - echo "Unable to find a .repo/manifests directory above '$PWD'" >&2 - unset WORK_ROOT # No point in saying we have one when we don't - return 1 -} -set_WORK_ROOT || exit 2 - -if [ "$DASH_JAY" == "" ]; then - if [ -x "$(command -v nproc)" ]; then - export DASH_JAY="-j $(nproc)" - else - export DASH_JAY="-j 4" - fi -fi - -# explanation of JOB_DESIGNATOR states: -# exists, empty string -> originated from release job, pass thru a null string -# exists, non-empty -> originated from other CI job, use as set, example: "dnnhc." -# does not exist -> dev or non-CI build, got to this point without instantiation -# so assign a default value: "local." -export JOB_DESIGNATOR="${JOB_DESIGNATOR-"local."}" -echo "JOB_DESIGNATOR=${JOB_DESIGNATOR}" - -# explanation of SLES_BUILD_ID_PREFIX states: -# exists, non-empty -> originated from sles job, use as set, example: "sles151." -# exists, empty string -> originated from non-sles job, pass thru a null string -# does not exist -> got to this point without instantiation so a default null string: "" -export SLES_BUILD_ID_PREFIX -echo "SLES_BUILD_ID_PREFIX=${SLES_BUILD_ID_PREFIX}" - -if [ -z "${BUILD_ID}" ]; then - export BUILD_ID=9999 -fi - -if [ -n "${JOB_NAME}" ]; then - export ROCM_BUILD_ID=${JOB_NAME/compute-/}-${BUILD_ID} -fi - -source /etc/os-release -#re-export the variables with less generic names -export DISTRO_NAME=$ID -export DISTRO_RELEASE=$VERSION_ID -export DISTRO_ID=$ID-$VERSION_ID - - -# Enable wheel package for Almainux-8 mainline builds -# Currently no wheel package required for static and ASAN builds -if [[ "${DISTRO_ID}" == almalinux-8* ]] && [[ "${ENABLE_ADDRESS_SANITIZER}" != "true" ]] && [[ "${ENABLE_STATIC_BUILD}" != "true" ]]; then - export WHEEL_PACKAGE=true -else - unset WHEEL_PACKAGE -fi - -case "${DISTRO_NAME}" in - ("ubuntu") export CPACKGEN=DEB PACKAGEEXT=deb PKGTYPE=deb ROCM_PKGTYPE=DEB ;; - ("centos") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("sles") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("rhel") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("mariner") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("azurelinux") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("almalinux") export CPACKGEN=RPM PACKAGEEXT=rpm PKGTYPE=rpm ROCM_PKGTYPE=RPM ;; - ("debian") export CPACKGEN=DEB PACKAGEEXT=deb PKGTYPE=deb ROCM_PKGTYPE=DEB ;; -esac - -# set up package file name variables for CPACK_GENERATOR -# rpm packages name are set with jenkins job designator and build no -# deb package is appendeded with OS version as well -export CPACK_DEBIAN_PACKAGE_RELEASE="${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}~$VERSION_ID" -export CPACK_RPM_PACKAGE_RELEASE="${JOB_DESIGNATOR}${SLES_BUILD_ID_PREFIX}${BUILD_ID}" - -export SCRIPT_PATH=$WORK_ROOT/brahma-utils/kfd-tools/scripts -export ENV_PATH=$SCRIPT_PATH/hsaThunk.env -OUT_DIR="${OUT_DIR:=$WORK_ROOT/out/$DISTRO_ID/$DISTRO_RELEASE}" -export OUT_DIR -export RT_TMP=$OUT_DIR/tmp/rt - -# Unused -# export ROCM_VERSION=$(git --git-dir=$WORK_ROOT/.repo/manifests/.git describe --always) - -#source transform, for things like ocl_lc -export SRC_TF_ROOT=$OUT_DIR/srctf - -# Read ROCm Version and calculate ROCm libpatch version from rocm_version.txt -# Using logic from calculateRocmPatchVersion() in common.gvy -get_rocm_libpatch_version() { - rocm_version=$1 - if [[ "${rocm_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - libpatch_version=${rocm_version//\./0} - echo "${libpatch_version}" - else - echo "Invalid ROCm Version: ${rocm_version}" - exit 10 - fi -} - -# Read the default ROCm version from rocm_version.txt if the ROCM_VERSION -# variable is either not set, empty or only contains spaces. -if [ -f "${BUILD_SCRIPT_ROOT}/rocm_version.txt" ] && [ -z $ROCM_VERSION ]; then - ROCM_VERSION="$(cat ${BUILD_SCRIPT_ROOT}/rocm_version.txt)" -fi - -# ROCM variables -# ROCM_VERSION and ROCM_LIBPATCH_VERSION are changed: Eg:"3.3.0" ~= 30300 -#default ROCM_VERSION: 9.99.99 and ROCM_LIBPATCH_VERSION: 99999 if not set -: ${ROCM_VERSION:="9.99.99"} -ROCM_LIBPATCH_VERSION=$(get_rocm_libpatch_version $ROCM_VERSION) -echo "ROCM_VERSION=${ROCM_VERSION}" -echo "ROCM_LIBPATCH_VERSION=${ROCM_LIBPATCH_VERSION}" -export ROCM_VERSION ROCM_LIBPATCH_VERSION - -# Previously we would put the job number into the ROCM_INSTALL_PATH -# This interacted badly with our desire to reuse builds, a it ment every build was unique -export ROCM_INSTALL_PATH="/opt/rocm-${ROCM_VERSION}" - -# Setting the ROCM_INSTALL_PATH id to Last Know Good build ID, PSDB incremental built packages will install into /opt/rocm- -# No longer applicable, as we no longer have the job number in the ROCM_INSTALL_PATH - -if [ -n "${AFAR_VERSION}" ]; then - # multi-version (side-by-side) install for Advanced Feature Access Release (AFAR) - # suggested AFAR_VERSION: "afar001" - # Hopefully this is correct for AFAR - ROCM_INSTALL_PATH="/opt/rocm-${AFAR_VERSION##-}" -fi - -if [[ "${ENABLE_STATIC_BUILDS}" == true ]]; then - # For static builds add a -static post fix in rocm folder - export ROCM_INSTALL_PATH="${ROCM_INSTALL_PATH}-static" -fi - -echo "Setting ROCM_INSTALL_PATH=${ROCM_INSTALL_PATH}" - -export ROCM_PATH="$ROCM_INSTALL_PATH" -export ROCM_LIBPATH="" -export DEVTOOLSET_LIBPATH="/opt/rh/devtoolset-7/root/usr/lib64;/opt/rh/devtoolset-7/root/usr/lib" - -# Source directories -# TODO: We should have autodiscoverable makefiles -export DIST_NO_DEBUG=yes -export OPENCL_MAINLINE=1 -# export P4_ROOT=$WORK_ROOT/p4 -# export RT_ROOT=$P4_ROOT/driver/ -export FW_ROOT=$WORK_ROOT/brahma-utils/firmware/deb-pkgs -# export HSA_ROOT=$WORK_ROOT/hsa -export HSA_SOURCE_ROOT=$WORK_ROOT/ROCR-Runtime -# export HSA_CLOSED_SOURCE_ROOT=$WORK_ROOT/p4/driver -export HSA_OPENSOURCE_ROOT=$HSA_SOURCE_ROOT/src -# export ROCR_ROOT=$HSA_ROOT/rocr-runtime -export ROCR_ROOT=$WORK_ROOT/ROCR-Runtime -export ROCRTST_ROOT=$HSA_SOURCE_ROOT/rocrtst -export HSA_CORE_ROOT=$HSA_OPENSOURCE_ROOT -export HSA_IMAGE_ROOT=$HSA_OPENSOURCE_ROOT/hsa-ext-image -export HSA_FINALIZE_ROOT=$HSA_OPENSOURCE_ROOT/hsa-ext-finalize -export HSA_TOOLS_ROOT=$HSA_OPENSOURCE_ROOT/hsa-runtime-tools -# export HSA_RT_ROOT=$RT_ROOT/drivers/hsa/runtime -# export OCL_RT_ROOT=$RT_ROOT/drivers/opencl -# export OCL_RT_STG_ROOT=$P4_ROOT/opencl -export OCL_RT_SRC_TF_ROOT=$SRC_TF_ROOT/ocl_lc -export KERNEL_ROOT=$WORK_ROOT/kernel -export SCRIPT_ROOT=$WORK_ROOT/build -export BUILD_SCRIPT_ROOT=$WORK_ROOT/ROCm/tools/rocm-build -export TEST_SCRIPT_ROOT=$WORK_ROOT/MLSEQA_TestRepo -export THUNK_ROOT=$WORK_ROOT/ROCT-Thunk-Interface -export AMDGPURASTOOL_ROOT=$WORK_ROOT/amdgpuras-tool -export AQLPROFILE_ROOT=$WORK_ROOT/aqlprofile -export ROCPROFILER_ROOT=$WORK_ROOT/rocprofiler -export ROCTRACER_ROOT=$WORK_ROOT/roctracer -export ROCPROFILER_REGISTER_ROOT=$WORK_ROOT/rocprofiler-register -export ROCPROFILER_SDK_ROOT=$WORK_ROOT/rocprofiler-sdk -export ROCPROFILER_COMPUTE_ROOT=$WORK_ROOT/rocprofiler-compute -export ROCPROFILER_SYSTEMS_ROOT=$WORK_ROOT/rocprofiler-systems -export UTILS_ROOT=$WORK_ROOT/rocm-utils -export KFDTEST_ROOT=$THUNK_ROOT/tests/kfdtest -# export HSA_SAMPLES_ROOT=$RT_ROOT/drivers/hsa/runtime/samples -# export CHIMEX_ROOT=$WORK_ROOT/benchmarks/chimex -# export AMDP2P_ROOT=$WORK_ROOT/drivers/amdp2p -# export HIP_ROOT=$WORK_ROOT/HIP -# export HIP_VDI_ROCM_SRC_TF_ROOT=$SRC_TF_ROOT/hip_vdi_rocm -# export HIP_VDI_PAL_SRC_TF_ROOT=$SRC_TF_ROOT/hip_vdi_pal -# export HIP_SAMPLES_ROOT=$WORK_ROOT/HIP-Examples -# export HIP_PRIVATE_SAMPLES_ROOT=$WORK_ROOT/hip-examples-private -export HIPIFY_ROOT=$WORK_ROOT/HIPIFY -# export GPUBURN_ROOT=$WORK_ROOT/tests/gpuburn -# export HSAPROFILER_TEST_ROOT=$WORK_ROOT/dev-tools/RCP-Internal/Src/Tests/HSAFoundationProfileAPITest -# export HSATESTCOMMON_ROOT=$WORK_ROOT/dev-tools/Common/Src/HSATestCommon -# export HSATESTGTEST_ROOT=$WORK_ROOT/dev-tools/Common/Lib/Ext/GoogleTest1.8/googletest -# export SMI_ROOT=$WORK_ROOT/rocm-smi -export AMD_SMI_LIB_ROOT=$WORK_ROOT/amdsmi -export ROCM_SMI_LIB_ROOT=$WORK_ROOT/rocm_smi_lib -export RSMITST_ROOT=$ROCM_SMI_LIB_ROOT/tests/rocm_smi_test -export LLVM_PROJECT_ROOT=$WORK_ROOT/llvm-project -export LLVM_ROOT=$LLVM_PROJECT_ROOT/llvm -export CLANG_ROOT=$LLVM_PROJECT_ROOT/clang -export LLD_ROOT=$LLVM_PROJECT_ROOT/lld -export HIPCC_ROOT=$LLVM_PROJECT_ROOT/amd/hipcc -export DEVICELIBS_ROOT=$LLVM_PROJECT_ROOT/amd/device-libs -export DKMS_ROOT=$WORK_ROOT/drivers/linux-dkms -export ROCM_ROOT=$WORK_ROOT/meta -export ROCM_CORE_ROOT=$WORK_ROOT/rocm-core -export ROCM_DEV_ROOT=$WORK_ROOT/meta/rocm-dev -export ROCM_CMAKE_ROOT=$WORK_ROOT/rocm-cmake -export ROCM_BANDWIDTH_TEST_ROOT=$WORK_ROOT/rocm_bandwidth_test -export ROCMINFO_ROOT=$WORK_ROOT/rocminfo -export ROCR_DEBUG_AGENT_ROOT=$WORK_ROOT/rocr_debug_agent -export COMGR_ROOT=$LLVM_PROJECT_ROOT/amd/comgr -export COMGR_LIB_PATH=$OUT_DIR/build/amd_comgr -# export HOSTCALL_ROOT=$WORK_ROOT/hostcall -export RCCL_ROOT=$WORK_ROOT/rccl -export ROCM_DBGAPI_ROOT=$WORK_ROOT/ROCdbgapi -export ROCM_GDB_ROOT=$WORK_ROOT/ROCgdb -# export ROCclr_ROOT=$WORK_ROOT/vdi -export HIP_ON_ROCclr_ROOT=$WORK_ROOT/hip -export HIPAMD_ROOT=$WORK_ROOT/hipamd -export HIP_CATCH_TESTS_ROOT=$WORK_ROOT/hip-tests -# export OPENCL_ON_ROCclr_ROOT=$WORK_ROOT/opencl-on-vdi -export CLR_ROOT=$WORK_ROOT/clr -export OPENCL_CTS_ROOT=$WORK_ROOT/OpenCL-CTS -export OPENCL_ICD_LOADER_ROOT=$WORK_ROOT/OpenCL-ICD-Loader -export OPENCL_HEADERS_ROOT=$WORK_ROOT/OpenCL-Headers -export OPENCL_CLHPP_ROOT=$WORK_ROOT/OpenCL-CLHPP -export AOMP_REPOS=$WORK_ROOT/openmp-extras -export HIPOTHER_ROOT=$WORK_ROOT/hipother - -# For libraries $ORIGIN -# For binaries $ORIGIN/../lib -export ROCM_LIB_RPATH='$ORIGIN' -export ROCM_EXE_RPATH='$ORIGIN/../lib' - -# For ASAN Libraries since the asan lib path is lib/asan/ -export ROCM_ASAN_LIB_RPATH='$ORIGIN:$ORIGIN/..' -export ROCM_ASAN_EXE_RPATH="\$ORIGIN/../lib/asan:\$ORIGIN/../lib" - -# Intermediate output directories for projects without build output relocation -export FW_OUT=$WORK_ROOT/brahma-utils/firmware/deb-pkgs - -export PATH=$PATH:$SCRIPT_ROOT -if [ -e "$SCRIPT_PATH/hsaThunk.util" ]; then - source $SCRIPT_PATH/hsaThunk.util $ENV_PATH $WORK_ROOT -fi - -# From setup_env.sh -export BUILD_TYPE=Release -export LIBS_WORK_DIR=$WORK_ROOT -export BUILD_ARTIFACTS=$OUT_DIR/$PACKAGEEXT - -export HIPCC_COMPILE_FLAGS_APPEND="-O3 -Wno-format-nonliteral -parallel-jobs=4" -export HIPCC_LINK_FLAGS_APPEND="-O3 -parallel-jobs=4" - -export PATH="${ROCM_PATH}/bin:${ROCM_PATH}/lib/llvm/bin:${PATH}:${HOME}/.local/bin" - -export LC_ALL=C.UTF-8 -export LANG=C.UTF-8 - -export PROC=${PROC:-"$(nproc)"} -# export RELEASE_FLAG=${RELEASE_FLAG:-"-r"} -export SUDO=sudo -export PATH=/usr/local/bin:${PATH}:/sbin:/bin -export CCACHE_DIR=${HOME}/.ccache - -# set ccache environment variable for math libraries -if [[ "${CCACHE_ENABLED}" != "false" ]]; then - export LAUNCHER_FLAGS="-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache -DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache" - export CCACHE_COMPILERCHECK=none - export CCACHE_EXTRAFILES=${OUT_DIR}/rocm_compilers_hash_file -fi diff --git a/tools/rocm-build/post_inst_pkg.sh b/tools/rocm-build/post_inst_pkg.sh deleted file mode 100755 index 225fe2ebc..000000000 --- a/tools/rocm-build/post_inst_pkg.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash - -set -x - - -UNTAR_COMPONENT_NAME=$1 - -# Static supported components -STATIC_SUPPORTED_COMPONENTS="comgr devicelibs hip_on_rocclr hipblas hipblas-common hipcc hiprand hipsolver hipsparse lightning openmp_extras rocblas rocm rocm_smi_lib rocm-cmake rocm-core rocminfo rocprim rocprofiler-register rocr rocrand rocsolver rocsparse" -if [ "${ENABLE_STATIC_BUILDS}" == "true" ] && ! echo "$STATIC_SUPPORTED_COMPONENTS" | grep -qE "(^| )$UNTAR_COMPONENT_NAME( |$)"; then - echo "Static build is not enabled for $UNTAR_COMPONENT_NAME ..skipping!!" - exit 0 -fi - -copy_pkg_files_to_rocm() { - local comp_folder=$1 - local comp_pkg_name=$2 - - cd "${OUT_DIR}/${PKGTYPE}/${comp_folder}"|| exit 2 - if [ "${PKGTYPE}" = 'deb' ]; then - dpkg-deb -x ${comp_pkg_name}_*.deb pkg/ - else - mkdir pkg && pushd pkg/ || exit 2 - if [[ "${comp_pkg_name}" != *-dev* ]]; then - rpm2cpio ../${comp_pkg_name}-*.rpm | cpio -idmv - else - rpm2cpio ../${comp_pkg_name}el-*.rpm | cpio -idmv - fi - popd || exit 2 - fi - ls ./pkg -alt - ${SUDO} cp -r ./pkg${ROCM_PATH}/* "${ROCM_PATH}" || exit 2 - rm -rf pkg/ -} - -get_os_name() { - local os_name - os_name=$(grep -oP '^NAME="\K.*(?=")' < /etc/os-release) - echo "${os_name,,}" -} - -set_pkg_type() { - local os_name - os_name=$(grep -oP '^NAME="\K.*(?=")' < /etc/os-release) - if [[ "${os_name,,}" == "ubuntu" || "${os_name,,}" == "debian gnu/linux" ]]; then - echo "deb" - else - echo "rpm" - fi -} - -set_llvm_link() { - local comp_folder=$1 - local comp_pkg_name=$2 - - cd "${OUT_DIR}/${PKGTYPE}/${comp_folder}"|| exit 2 - if [ "${PKGTYPE}" = 'deb' ]; then - dpkg-deb -e ${comp_pkg_name}_*.deb post/ - mkdir -p "${ROCM_PATH}/tmp_llvm" - cp 'post/postinst' "${ROCM_PATH}/tmp_llvm" - pushd "${ROCM_PATH}/tmp_llvm" - bash -x postinst - popd - rm -rf "${ROCM_PATH}/tmp_llvm" post/ - fi -} - -setup_rocm_compilers_hash_file() { - local clang_version - clang_version="$("${ROCM_PATH}/llvm/bin/clang" --version | head -n 1)" - printf '%s: %s\n' 'clang version' "${clang_version}" | tee "${OUT_DIR}/rocm_compilers_hash_file" -} - -PKGTYPE=$(set_pkg_type) - -case $UNTAR_COMPONENT_NAME in - (lightning) - if [ "${CCACHE_ENABLED}" == "true" ] ; then - setup_rocm_compilers_hash_file - fi - - mkdir -p ${ROCM_PATH}/bin - printf '%s\n' > ${ROCM_PATH}/bin/target.lst gfx900 gfx906 gfx908 gfx803 gfx1030 - - if [ -e "${ROCM_PATH}/lib/llvm/bin/rocm.cfg" ]; then - sed -i '/-frtlib-add-rpath/d' ${ROCM_PATH}/lib/llvm/bin/rocm.cfg - elif [ -e "${ROCM_PATH}/llvm/bin/rocm.cfg" ]; then - sed -i '/-frtlib-add-rpath/d' ${ROCM_PATH}/llvm/bin/rocm.cfg - fi - - # set_llvm_link lightning rocm-llvm - ln -s "${ROCM_PATH}/lib/llvm/bin/amdclang" "${ROCM_PATH}/bin/amdclang" || true - ln -s "${ROCM_PATH}/lib/llvm/bin/amdclang++" "${ROCM_PATH}/bin/amdclang++" || true - ;; - (hipify_clang) - chmod +x ${ROCM_PATH}/bin/hipify-perl - ;; - (hip_on_rocclr) - rm -f ${ROCM_PATH}/bin/hipcc.bat - # hack transferbench source code - sed -i 's/^set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ..)/#&/' "$WORK_ROOT/TransferBench/CMakeLists.txt" - ;; - (rocblas) - if [ $ENABLE_ADDRESS_SANITIZER != 'true' ]; then - pkgName=rocblas-dev - if [ "${ENABLE_STATIC_BUILDS}" == "true" ]; then - pkgName=rocblas-static-dev - fi - copy_pkg_files_to_rocm rocblas $pkgName - fi - ;; - (composable_kernel) - cd "${OUT_DIR}/${PKGTYPE}/composable_kernel" - if [ "${PKGTYPE}" = 'deb' ]; then - dpkg-deb -c composablekernel-dev*.deb | awk '{sub(/^\./, "", $6); print $6}' | tee ../../ck.files - else - rpm -qlp composablekernel-dev*.rpm | tee ../../ck.files - fi - ;; - (*) - echo "post processing is not required for ${UNTAR_COMPONENT_NAME}" - ;; -esac - diff --git a/tools/rocm-build/rocm-6.2.0.xml b/tools/rocm-build/rocm-6.2.0.xml deleted file mode 100644 index d9bdc9629..000000000 --- a/tools/rocm-build/rocm-6.2.0.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/rocm-build/rocm-6.2.1.xml b/tools/rocm-build/rocm-6.2.1.xml deleted file mode 100644 index 0edd17884..000000000 --- a/tools/rocm-build/rocm-6.2.1.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.2.2.xml b/tools/rocm-build/rocm-6.2.2.xml deleted file mode 100644 index b2cce25f6..000000000 --- a/tools/rocm-build/rocm-6.2.2.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/rocm-build/rocm-6.2.4.xml b/tools/rocm-build/rocm-6.2.4.xml deleted file mode 100644 index e23fdbb26..000000000 --- a/tools/rocm-build/rocm-6.2.4.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.3.0.xml b/tools/rocm-build/rocm-6.3.0.xml deleted file mode 100644 index abd29cf12..000000000 --- a/tools/rocm-build/rocm-6.3.0.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.3.1.xml b/tools/rocm-build/rocm-6.3.1.xml deleted file mode 100644 index 8e3620cc2..000000000 --- a/tools/rocm-build/rocm-6.3.1.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.3.2.xml b/tools/rocm-build/rocm-6.3.2.xml deleted file mode 100644 index 6b74443cf..000000000 --- a/tools/rocm-build/rocm-6.3.2.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.3.3.xml b/tools/rocm-build/rocm-6.3.3.xml deleted file mode 100644 index a4abd388c..000000000 --- a/tools/rocm-build/rocm-6.3.3.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.4.0.xml b/tools/rocm-build/rocm-6.4.0.xml deleted file mode 100644 index 9e757c8da..000000000 --- a/tools/rocm-build/rocm-6.4.0.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.4.1.xml b/tools/rocm-build/rocm-6.4.1.xml deleted file mode 100644 index 10f5146f9..000000000 --- a/tools/rocm-build/rocm-6.4.1.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.4.2.xml b/tools/rocm-build/rocm-6.4.2.xml deleted file mode 100644 index 611151012..000000000 --- a/tools/rocm-build/rocm-6.4.2.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-6.4.3.xml b/tools/rocm-build/rocm-6.4.3.xml deleted file mode 100644 index 7d3710a87..000000000 --- a/tools/rocm-build/rocm-6.4.3.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-7.0.0.xml b/tools/rocm-build/rocm-7.0.0.xml deleted file mode 100644 index bc23b4e58..000000000 --- a/tools/rocm-build/rocm-7.0.0.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-7.0.1.xml b/tools/rocm-build/rocm-7.0.1.xml deleted file mode 100644 index 5d856c08a..000000000 --- a/tools/rocm-build/rocm-7.0.1.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/rocm-7.0.2.xml b/tools/rocm-build/rocm-7.0.2.xml deleted file mode 100644 index 8ad54e0f0..000000000 --- a/tools/rocm-build/rocm-7.0.2.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/rocm-build/runner b/tools/rocm-build/runner deleted file mode 100755 index ac0dcf1af..000000000 --- a/tools/rocm-build/runner +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -xe -# Run a ${INFRA_REPO}/build_$1.sh script -# Return the exit status -# Run a ccache -s before and after - -: Running $0 "$@" -date '+%D %T (%s)' -component=$1 -shift - -# errorhandler(){ -# local RC=$? # Save exit status -# # bash doesn't call error handlers from within error handlers -# # but be on the safe side and disable it anyhow. -# set +e -# } -# trap errorhandler ERR - -doit(){ - bash -x "${INFRA_REPO}/build_${component}.sh" "$@" && - ${INFRA_REPO}/post_inst_pkg.sh "${component}" -} - -final(){ - set +e - date '+%D %T (%s)' - : 'Final ccache stats' - ccache -s || echo ccache failed tto show stats - : 'Output from "times" builtin' - times -} -trap final EXIT - - -: 'Initial ccache stats' -ccache -s || echo ccache failed to show stats -source ${INFRA_REPO}/envsetup.sh -${INFRA_REPO}/build_${component}.sh -c -time doit "$@" diff --git a/tools/rocm-build/upload_packages.sh b/tools/rocm-build/upload_packages.sh deleted file mode 100755 index 3e3b43fda..000000000 --- a/tools/rocm-build/upload_packages.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -set -x - - -BUILD_COMPONENT="$1" -PACKAGEEXT=${PACKAGEEXT:-$2} -COMP_DIR=$(./${INFRA_REPO}/build_${BUILD_COMPONENT}.sh -o ${PACKAGEEXT}) -TARGET_ARTI_URL=${TARGET_ARTI_URL:-$3} - -if { [ "$DISTRO_ID" = "mariner-2.0" ] || [ "$DISTRO_ID" = "azurelinux-3.0" ]; } \ - && { [ "$BUILD_COMPONENT" = "rocprofiler-systems" ] || [ "$BUILD_COMPONENT" = "rocjpeg" ] || [ "$BUILD_COMPONENT" = "rocdecode" ] || [ "$BUILD_COMPONENT" = "rocal" ] || [ "$BUILD_COMPONENT" = "mivisionx" ]; }; -then - echo "Skip uploading packages for ${BUILD_COMPONENT} on ${DISTRO_ID} distro" - exit 0 -fi - -if { [ "$DISTRO_ID" = "debian-10" ] ; } \ - && { [ "$BUILD_COMPONENT" = "rocdecode" ] || [ "$BUILD_COMPONENT" = "rocjpeg" ]; }; -then - echo "Skip uploading packages for ${BUILD_COMPONENT} on ${DISTRO_ID} distro" - exit 0 -fi - -if [ "$DISTRO_ID" = centos-7 ] && [ "$BUILD_COMPONENT" = "rocprofiler-compute" ]; then - echo "Skip uploading packages for ${BUILD_COMPONENT} on Centos7 distro, due to python dependency" - exit 0 -fi - -# Static supported components -STATIC_SUPPORTED_COMPONENTS="comgr devicelibs hip_on_rocclr hipblas hipblas-common hipcc hiprand hipsolver hipsparse lightning openmp_extras rocblas rocm rocm_smi_lib rocm-cmake rocm-core rocminfo rocprim rocprofiler-register rocr rocrand rocsolver rocsparse" -if [ "${ENABLE_STATIC_BUILDS}" == "true" ] && ! echo "$STATIC_SUPPORTED_COMPONENTS" | grep -qE "(^| )$BUILD_COMPONENT( |$)"; then - echo "Static build is not enabled for $BUILD_COMPONENT ..skipping upload!!" - exit 0 -fi - -[ -z "$JFROG_TOKEN" ] && echo "JFrog token is not set, skip uploading..." && exit 0 -[ -z "$TARGET_ARTI_URL" ] && echo "Target URL is not set, skip uploading..." && exit 0 -[ -z "$COMP_DIR" ] && echo "No packages in ${BUILD_COMPONENT}" && exit 0 - -PKG_NAME_LIST=( "${COMP_DIR}"/* ) - -#retry function take two arguments sytems cmd and attempt as input and retry the system cmd for given attempts times 30 seconds -function retry_sys_cmd() { - local sys_cmd="$1" - local -i attempts=$2 - local -i attempt_num=1 - echo "running system command: $sys_cmd" - until $sys_cmd - do - if (( attempt_num == attempts )) - then - echo "Attempt $attempt_num failed and there are no more attempts left!" - return 1 - else - sleep_for=$(( attempt_num * 30 )) - echo "Attempt $attempt_num failed! Trying again in $sleep_for seconds..." - sleep $sleep_for - (( attempt_num++ )) - fi - done -} - -for pkg in "${PKG_NAME_LIST[@]}"; do - #Do not upload any packages which does'nt have "asan" in its name for ASAN enabled builds - if [[ "${ENABLE_ADDRESS_SANITIZER}" != "true" ]] || [[ "${pkg##*/}" =~ "-asan" ]]; then - UPLOAD_SERVER=${TARGET_ARTI_URL} - if [[ "${pkg##*.}" == whl ]]; then - UPLOAD_SERVER=${WHEEL_ARTI_URL} - if [[ "${pkg##*/}" =~ "_dbgsym" ]] || [[ "${pkg##*/}" =~ "_debuginfo" ]]; then - echo "Discarding debug info wheel package. Continue with next package " - continue - fi - fi - if [[ "${pkg##*/}" =~ "-asan-dbgsym" ]] || [[ "${pkg##*/}" =~ "-tests-dbgsym" ]] || [[ "${pkg##*/}" =~ "-asan-debuginfo" ]] || [[ "${pkg##*/}" =~ "-tests-debuginfo" ]]; then - # ROCMOPS-7047 , if we stop uploading the asan-dbgsym and tests-dbgsym package to artifactory the debug+rpath (asan-dbgsym-rpath) - # and multi version (asan-dbgsym_) package will stop getting created as well . They get created as part of version_pkgs job - echo "skipping upload of asan-dbgsym/asan-debuginfo or tests-dbgsym/tests-debuginfo package ${pkg}. Continue with next package " - continue - fi - echo "Uploading $pkg ..." - curl_cmd="curl -H "X-JFrog-Art-Api:${JFROG_TOKEN}" \ - -X PUT "${UPLOAD_SERVER}/$(basename ${pkg})" \ - -T "${COMP_DIR}/$(basename ${pkg})"" - #calling retry function with 5 attempts sleep will be 30s, 60s, 90s, 120s - total of 5 attemps in 4 minutes - if ! retry_sys_cmd "$curl_cmd" 5; then - echo "Unable to upload $pkg ..." >&2 && exit 1 - fi - echo "$pkg uploaded..." - fi -done