Compare commits

...

23 Commits

Author SHA1 Message Date
alexxu-amd
2d560a7499 Merge pull request #5550 from peterjunpark/roc-7.9
Merge branch 'docs/7.9.0' into roc-7.9
2025-10-20 15:59:37 -04:00
Peter Park
6dfecda93c Fix documentation linting errors
lint: change tabs to spaces in compatibility-matrix.md

lint: fix heading level and whitespaces

lint: fix whitespace
2025-10-20 15:57:13 -04:00
Peter Park
ec02384cb9 Merge remote-tracking branch 'upstream/docs/7.9.0' into roc-7.9 2025-10-20 15:11:52 -04:00
jayhawk-commits
ca1170e6a6 Point to TheRock 7.9 branch and remove manifest 2025-10-20 14:42:41 -04:00
Adel Johar
2ec051dec5 Merge pull request #5531 from adeljo-amd/ci_examples
[Ex CI] Add libomp-dev, MIVisionX, rocDecode and dependencies
2025-10-20 09:55:02 +02:00
Pratik Basyal
fd6bbe18a7 PLDM update for MI250 and MI210 [Develop] (#5537)
* PLDM update for MI250 and MI210

* PLDM update
2025-10-17 17:13:42 -04:00
peterjunpark
a613bd6824 JAX Maxtext v25.9 doc update (#5532)
* archive previous version (25.7)

* update docker components list for 25.9

* update template

* update docker pull tag

* update

* fix intro
2025-10-17 11:31:06 -04:00
Adel Johar
b3459da524 [Ex CI] Add libomp-dev, MIVisionX, rocDecode 2025-10-17 14:02:54 +02:00
peterjunpark
14bb59fca9 Update Megatron/PyTorch Primus 25.9 docs (#5528)
* add previous versions

* Fix heading levels in pages using embedded templates (#5468)

* update primus-megatron doc

update megatron-lm doc

update templates

fix tab

update primus-megatron model configs

Update primus-pytorch model configs

fix css class

add posttrain to pytorch-training template

update data sheets

update

update

update

update docker tags

* Add known issue and update Primus/Turbo versions

* add primus ver to histories

* update primus ver to 0.1.1

* fix leftovers from merge conflict
2025-10-16 12:51:30 -04:00
anisha-amd
a98236a4e3 Main Docs: references of accelerator removal and change to GPU (#5495)
* Docs: references of accelerator removal and change to GPU

Co-authored-by: Leo Paoletti <164940351+lpaoletti@users.noreply.github.com>
Co-authored-by: Pratik Basyal <pratik.basyal@amd.com>
2025-10-16 11:22:10 -04:00
David Dixon
5cb6bfe151 Add yaml-cpp to dependencies 2025-10-16 07:26:06 -06:00
David Dixon
6e7422ded7 Update cli11.yml for Azure Pipelines (#5523) 2025-10-15 10:47:29 -06:00
Istvan Kiss
7b7ff53985 Update Radeon link (#5453) 2025-10-15 17:25:05 +02:00
David Dixon
019796dc63 [external] Create cli11.yml (#5522) 2025-10-15 09:19:56 -06:00
Pratik Basyal
f21cfe1171 GitHub issue added to 702 known issues (#5520)
* GitHub issue added to 702 known issues

* Added missing RCCL changelog
2025-10-15 09:58:23 -04:00
Jan Stephan
170cb47a4f Merge pull request #5512 from j-stephan/rocm-examples-deps
[Ex CI] Add libtiff-dev, libopencv-dev and rpp
2025-10-15 10:02:46 +02:00
Braden Stefanuk
d19a8e4a83 [superbuild] Add dependencies for hipblaslt and origami (#5487)
* ci: add deps for origami in superbuild

* ci: add rocm path to system path

* build: add pip msgpack dep
2025-10-14 16:05:24 -06:00
amd-hsivasun
3a0b8529ed [Ex CI] Added MIOpen to the test dependencies for rocm-examples (#5517) 2025-10-14 14:56:36 -04:00
Joseph Macaranas
f9d7fc2e6a [External CI] Add libsimde-dev to ROCR pipeline (#5515) 2025-10-14 14:24:45 -04:00
Nilesh M Negi
d424687191 [Ex CI] Increase RCCL build time limit to 120mins (#5516) 2025-10-14 12:59:40 -05:00
Jan Stephan
35e6e50888 [Ex CI] Add libopencv-dev
Signed-off-by: Jan Stephan <jan.stephan@amd.com>
2025-10-13 20:00:25 +02:00
Jan Stephan
91cfe98eb3 [Ex CI] Add libtiff-dev and rpp
Signed-off-by: Jan Stephan <jan.stephan@amd.com>
2025-10-13 17:42:59 +02:00
Pratik Basyal
036aaa2e78 ROCm for HPC topic updated Develop (#5504)
* ROCm for HPC topic updated

* ROCm for HPC topic udpated

* Minor editorial
2025-10-10 22:31:51 -04:00
156 changed files with 4166 additions and 15557 deletions

View File

@@ -37,6 +37,7 @@ parameters:
- libdrm-dev
- libelf-dev
- libnuma-dev
- libsimde-dev
- ninja-build
- pkg-config
- name: rocmDependencies

View File

@@ -70,7 +70,7 @@ parameters:
jobs:
- ${{ each job in parameters.jobMatrix.buildJobs }}:
- job: rccl_build_${{ job.target }}
timeoutInMinutes: 90
timeoutInMinutes: 120
variables:
- group: common
- template: /.azuredevops/variables-global.yml

View File

@@ -17,8 +17,14 @@ parameters:
- libdw-dev
- libglfw3-dev
- libmsgpack-dev
- libomp-dev
- libopencv-dev
- libtbb-dev
- libtiff-dev
- libva-amdgpu-dev
- libavcodec-dev
- libavformat-dev
- libavutil-dev
- ninja-build
- python3-pip
- name: rocmDependencies
@@ -38,7 +44,9 @@ parameters:
- hipTensor
- llvm-project
- MIOpen
- MIVisionX
- rocBLAS
- rocDecode
- rocFFT
- rocJPEG
- rocPRIM
@@ -50,6 +58,7 @@ parameters:
- rocSPARSE
- rocThrust
- rocWMMA
- rpp
- name: rocmTestDependencies
type: object
default:
@@ -66,7 +75,10 @@ parameters:
- hipSPARSE
- hipTensor
- llvm-project
- MIOpen
- MIVisionX
- rocBLAS
- rocDecode
- rocFFT
- rocminfo
- rocPRIM
@@ -80,6 +92,7 @@ parameters:
- rocThrust
- roctracer
- rocWMMA
- rpp
- name: jobMatrix
type: object

View File

@@ -43,9 +43,14 @@ parameters:
- ninja-build
- python3-pip
- python3-venv
- googletest
- libgtest-dev
- libgmock-dev
- libboost-filesystem-dev
- name: pipModules
type: object
default:
- msgpack
- joblib
- "packaging>=22.0"
- pytest
@@ -147,6 +152,13 @@ jobs:
echo "##vso[task.prependpath]$USER_BASE/bin"
echo "##vso[task.setvariable variable=PytestCmakePath]$USER_BASE/share/Pytest/cmake"
displayName: Set cmake configure paths
- task: Bash@3
displayName: Add ROCm binaries to PATH
inputs:
targetType: inline
script: |
echo "##vso[task.prependpath]$(Agent.BuildDirectory)/rocm/bin"
echo "##vso[task.prependpath]$(Agent.BuildDirectory)/rocm/llvm/bin"
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/build-cmake.yml
parameters:
os: ${{ job.os }}

View File

@@ -0,0 +1,63 @@
parameters:
- name: checkoutRepo
type: string
default: 'self'
- name: checkoutRef
type: string
default: ''
- name: cli11Version
type: string
default: ''
- name: aptPackages
type: object
default:
- cmake
- git
- ninja-build
- name: jobMatrix
type: object
default:
buildJobs:
- { os: ubuntu2204, packageManager: apt}
- { os: almalinux8, packageManager: dnf}
jobs:
- ${{ each job in parameters.jobMatrix.buildJobs }}:
- job: cli11_${{ job.os }}
variables:
- group: common
- template: /.azuredevops/variables-global.yml
pool:
vmImage: 'ubuntu-22.04'
${{ if eq(job.os, 'almalinux8') }}:
container:
image: rocmexternalcicd.azurecr.io/manylinux228:latest
endpoint: ContainerService3
workspace:
clean: all
steps:
- checkout: none
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/dependencies-other.yml
parameters:
aptPackages: ${{ parameters.aptPackages }}
packageManager: ${{ job.packageManager }}
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/preamble.yml
- task: Bash@3
displayName: Clone cli11 ${{ parameters.cli11Version }}
inputs:
targetType: inline
script: git clone https://github.com/CLIUtils/CLI11.git -b ${{ parameters.cli11Version }}
workingDirectory: $(Agent.BuildDirectory)
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/build-cmake.yml
parameters:
os: ${{ job.os }}
cmakeBuildDir: $(Agent.BuildDirectory)/CLI11/build
cmakeSourceDir: $(Agent.BuildDirectory)/CLI11
useAmdclang: false
extraBuildFlags: >-
-DCMAKE_BUILD_TYPE=Release
-GNinja
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/artifact-upload.yml
parameters:
os: ${{ job.os }}

View File

@@ -0,0 +1,66 @@
parameters:
- name: checkoutRepo
type: string
default: 'self'
- name: checkoutRef
type: string
default: ''
- name: yamlcppVersion
type: string
default: ''
- name: aptPackages
type: object
default:
- cmake
- git
- ninja-build
- name: jobMatrix
type: object
default:
buildJobs:
- { os: ubuntu2204, packageManager: apt}
- { os: almalinux8, packageManager: dnf}
jobs:
- ${{ each job in parameters.jobMatrix.buildJobs }}:
- job: yamlcpp_${{ job.os }}
variables:
- group: common
- template: /.azuredevops/variables-global.yml
pool:
vmImage: 'ubuntu-22.04'
${{ if eq(job.os, 'almalinux8') }}:
container:
image: rocmexternalcicd.azurecr.io/manylinux228:latest
endpoint: ContainerService3
workspace:
clean: all
steps:
- checkout: none
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/dependencies-other.yml
parameters:
aptPackages: ${{ parameters.aptPackages }}
packageManager: ${{ job.packageManager }}
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/preamble.yml
- task: Bash@3
displayName: Clone yaml-cpp ${{ parameters.yamlcppVersion }}
inputs:
targetType: inline
script: git clone https://github.com/jbeder/yaml-cpp.git -b ${{ parameters.yamlcppVersion }}
workingDirectory: $(Agent.BuildDirectory)
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/build-cmake.yml
parameters:
os: ${{ job.os }}
cmakeBuildDir: $(Agent.BuildDirectory)/yaml-cpp/build
cmakeSourceDir: $(Agent.BuildDirectory)/yaml-cpp
useAmdclang: false
extraBuildFlags: >-
-DCMAKE_BUILD_TYPE=Release
-DYAML_CPP_BUILD_TOOLS=OFF
-DYAML_BUILD_SHARED_LIBS=OFF
-DYAML_CPP_INSTALL=ON
-GNinja
- template: ${{ variables.CI_TEMPLATE_PATH }}/steps/artifact-upload.yml
parameters:
os: ${{ job.os }}

View File

@@ -0,0 +1,23 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml
parameters:
- name: cli11Version
type: string
default: "main"
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
trigger: none
pr: none
jobs:
- template: ${{ variables.CI_DEPENDENCIES_PATH }}/cli11.yml
parameters:
cli11Version: ${{ parameters.cli11Version }}

View File

@@ -0,0 +1,24 @@
variables:
- group: common
- template: /.azuredevops/variables-global.yml
parameters:
- name: yamlcppVersion
type: string
default: "0.8.0"
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm
trigger: none
pr: none
jobs:
- template: ${{ variables.CI_DEPENDENCIES_PATH }}/yamlcpp.yml
parameters:
yamlcppVersion: ${{ parameters.yamlcppVersion }}

View File

@@ -36,6 +36,7 @@ Arb
Autocast
BARs
BatchNorm
BKC
BLAS
BMC
BabelStream
@@ -79,6 +80,7 @@ CentOS
ChatGPT
CoRR
Codespaces
ComfyUI
Commitizen
CommonMark
Concretized
@@ -177,6 +179,7 @@ GLXT
Gloo
GMI
GPG
GPGPU
GPR
GPT
GPU
@@ -295,6 +298,7 @@ MVAPICH
MVFFR
Makefile
Makefiles
ManyLinux
Matplotlib
Matrox
MaxText
@@ -375,6 +379,7 @@ perf
PEQT
PIL
PILImage
PLDM
POR
PRNG
PRs
@@ -439,6 +444,7 @@ SBIOS
SCA
ScaledGEMM
SDK
SDKs
SDMA
SDPA
SDRAM
@@ -485,6 +491,7 @@ TCIU
TCP
TCR
TVM
TheRock
THREADGROUPS
threadgroups
TensorRT
@@ -877,6 +884,7 @@ radeon
rccl
rdc
rdma
redhat
reStructuredText
redirections
refactorization
@@ -929,6 +937,7 @@ roctracer
rst
runtime
runtimes
ryzen
ResNet
sL
scalability
@@ -990,6 +999,7 @@ tracebacks
txt
TopK
uarch
ubuntu
uncached
uncacheable
uncorrectable

View File

@@ -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.

View File

@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="rocm-org" fetch="https://github.com/ROCm/" />
<default revision="refs/tags/rocm-7.0.2"
remote="rocm-org"
sync-c="true"
sync-j="4" />
<!--list of projects for ROCm-->
<project name="ROCK-Kernel-Driver" />
<project name="ROCR-Runtime" />
<project name="amdsmi" />
<project name="aqlprofile" />
<project name="rdc" />
<project name="rocm_bandwidth_test" />
<project name="rocm_smi_lib" />
<project name="rocm-core" />
<project name="rocm-examples" />
<project name="rocminfo" />
<project name="rocprofiler" />
<project name="rocprofiler-register" />
<project name="rocprofiler-sdk" />
<project name="rocprofiler-compute" />
<project name="rocprofiler-systems" />
<project name="roctracer" />
<!--HIP Projects-->
<project name="hip" />
<project name="hip-tests" />
<project name="HIPIFY" />
<project name="clr" />
<project name="hipother" />
<!-- The following projects are all associated with the AMDGPU LLVM compiler -->
<project name="half" />
<project name="llvm-project" />
<project name="spirv-llvm-translator" />
<!-- gdb projects -->
<project name="ROCdbgapi" />
<project name="ROCgdb" />
<project name="rocr_debug_agent" />
<!-- ROCm Libraries -->
<project groups="mathlibs" name="AMDMIGraphX" />
<project groups="mathlibs" name="MIVisionX" />
<project groups="mathlibs" name="ROCmValidationSuite" />
<project groups="mathlibs" name="composable_kernel" />
<project groups="mathlibs" name="hipTensor" />
<project groups="mathlibs" name="hipfort" />
<project groups="mathlibs" name="rccl" />
<project groups="mathlibs" name="rocAL" />
<project groups="mathlibs" name="rocALUTION" />
<project groups="mathlibs" name="rocDecode" />
<project groups="mathlibs" name="rocJPEG" />
<!-- The following components have been migrated to rocm-libraries:
hipBLAS-common hipBLAS hipBLASLt hipCUB
hipFFT hipRAND hipSPARSE hipSPARSELt
MIOpen rocBLAS rocFFT rocPRIM rocRAND
rocSPARSE rocThrust Tensile -->
<project groups="mathlibs" name="rocm-libraries" />
<project groups="mathlibs" name="rocPyDecode" />
<project groups="mathlibs" name="rocSHMEM" />
<project groups="mathlibs" name="rocWMMA" />
<project groups="mathlibs" name="rocm-cmake" />
<project groups="mathlibs" name="rpp" />
<project groups="mathlibs" name="TransferBench" />
<!-- Projects for OpenMP-Extras -->
<project name="aomp" path="openmp-extras/aomp" />
<project name="aomp-extras" path="openmp-extras/aomp-extras" />
<project name="flang" path="openmp-extras/flang" />
</manifest>

View File

@@ -1,47 +1,16 @@
dockers:
- pull_tag: rocm/jax-training:maxtext-v25.7-jax060
- pull_tag: rocm/jax-training:maxtext-v25.9
docker_hub_url: https://hub.docker.com/layers/rocm/jax-training/maxtext-v25.7/images/sha256-45f4c727d4019a63fc47313d3a5f5a5105569539294ddfd2d742218212ae9025
components:
ROCm: 6.4.1
JAX: 0.6.0
Python: 3.10.12
Transformer Engine: 2.1.0+90d703dd
hipBLASLt: 1.1.0-499ece1c21
- pull_tag: rocm/jax-training:maxtext-v25.7
docker_hub_url: https://hub.docker.com/layers/rocm/jax-training/maxtext-v25.7/images/sha256-45f4c727d4019a63fc47313d3a5f5a5105569539294ddfd2d742218212ae9025
components:
ROCm: 6.4.1
JAX: 0.5.0
Python: 3.10.12
Transformer Engine: 2.1.0+90d703dd
ROCm: 7.0.0
JAX: 0.6.2
Python: 3.10.18
Transformer Engine: 2.2.0.dev0+c91bac54
hipBLASLt: 1.x.x
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.3 70B
mad_tag: jax_maxtext_train_llama-3.3-70b
model_repo: Llama-3.3-70B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.1 8B
mad_tag: jax_maxtext_train_llama-3.1-8b
model_repo: Llama-3.1-8B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.1 70B
mad_tag: jax_maxtext_train_llama-3.1-70b
model_repo: Llama-3.1-70B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3 8B
mad_tag: jax_maxtext_train_llama-3-8b
multinode_training_script: llama3_8b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 3 70B
mad_tag: jax_maxtext_train_llama-3-70b
multinode_training_script: llama3_70b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 2 7B
mad_tag: jax_maxtext_train_llama-2-7b
model_repo: Llama-2-7B
@@ -54,6 +23,29 @@ model_groups:
precision: bf16
multinode_training_script: llama2_70b_multinode.sh
doc_options: ["single-node", "multi-node"]
- model: Llama 3 8B (multi-node)
mad_tag: jax_maxtext_train_llama-3-8b
multinode_training_script: llama3_8b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 3 70B (multi-node)
mad_tag: jax_maxtext_train_llama-3-70b
multinode_training_script: llama3_70b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 3.1 8B
mad_tag: jax_maxtext_train_llama-3.1-8b
model_repo: Llama-3.1-8B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.1 70B
mad_tag: jax_maxtext_train_llama-3.1-70b
model_repo: Llama-3.1-70B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.3 70B
mad_tag: jax_maxtext_train_llama-3.3-70b
model_repo: Llama-3.3-70B
precision: bf16
doc_options: ["single-node"]
- group: DeepSeek
tag: deepseek
models:

View File

@@ -1,14 +1,21 @@
dockers:
- pull_tag: rocm/megatron-lm:v25.8_py310
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.8_py310/images/sha256-50fc824361054e445e86d5d88d5f58817f61f8ec83ad4a7e43ea38bbc4a142c0
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
MI355X and MI350X:
pull_tag: rocm/megatron-lm:v25.9_gfx950
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.9_gfx950/images/sha256-1a198be32f49efd66d0ff82066b44bd99b3e6b04c8e0e9b36b2c481e13bff7b6
components: &docker_components
ROCm: 7.0.0
Primus: aab4234
PyTorch: 2.9.0.dev20250821+rocm7.0.0.lw.git125803b7
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
hipBLASLt: d1b517fc7a
Triton: 3.3.0
RCCL: 2.22.3
Flash Attention: 2.8.3
hipBLASLt: 911283acd1
Triton: 3.4.0+rocm7.0.0.git56765e8c
RCCL: 2.26.6
MI325X and MI300X:
pull_tag: rocm/megatron-lm:v25.9_gfx942
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.9_gfx942/images/sha256-df6ab8f45b4b9ceb100fb24e19b2019a364e351ee3b324dbe54466a1d67f8357
components: *docker_components
model_groups:
- group: Meta Llama
tag: llama
@@ -19,8 +26,6 @@ model_groups:
mad_tag: pyt_megatron_lm_train_llama-3.1-8b
- model: Llama 3.1 70B
mad_tag: pyt_megatron_lm_train_llama-3.1-70b
- model: Llama 3.1 70B (proxy)
mad_tag: pyt_megatron_lm_train_llama-3.1-70b-proxy
- model: Llama 2 7B
mad_tag: pyt_megatron_lm_train_llama-2-7b
- model: Llama 2 70B

View File

@@ -0,0 +1,72 @@
dockers:
- pull_tag: rocm/jax-training:maxtext-v25.7-jax060
docker_hub_url: https://hub.docker.com/layers/rocm/jax-training/maxtext-v25.7/images/sha256-45f4c727d4019a63fc47313d3a5f5a5105569539294ddfd2d742218212ae9025
components:
ROCm: 6.4.1
JAX: 0.6.0
Python: 3.10.12
Transformer Engine: 2.1.0+90d703dd
hipBLASLt: 1.1.0-499ece1c21
- pull_tag: rocm/jax-training:maxtext-v25.7
docker_hub_url: https://hub.docker.com/layers/rocm/jax-training/maxtext-v25.7/images/sha256-45f4c727d4019a63fc47313d3a5f5a5105569539294ddfd2d742218212ae9025
components:
ROCm: 6.4.1
JAX: 0.5.0
Python: 3.10.12
Transformer Engine: 2.1.0+90d703dd
hipBLASLt: 1.x.x
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.3 70B
mad_tag: jax_maxtext_train_llama-3.3-70b
model_repo: Llama-3.3-70B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.1 8B
mad_tag: jax_maxtext_train_llama-3.1-8b
model_repo: Llama-3.1-8B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3.1 70B
mad_tag: jax_maxtext_train_llama-3.1-70b
model_repo: Llama-3.1-70B
precision: bf16
doc_options: ["single-node"]
- model: Llama 3 8B
mad_tag: jax_maxtext_train_llama-3-8b
multinode_training_script: llama3_8b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 3 70B
mad_tag: jax_maxtext_train_llama-3-70b
multinode_training_script: llama3_70b_multinode.sh
doc_options: ["multi-node"]
- model: Llama 2 7B
mad_tag: jax_maxtext_train_llama-2-7b
model_repo: Llama-2-7B
precision: bf16
multinode_training_script: llama2_7b_multinode.sh
doc_options: ["single-node", "multi-node"]
- model: Llama 2 70B
mad_tag: jax_maxtext_train_llama-2-70b
model_repo: Llama-2-70B
precision: bf16
multinode_training_script: llama2_70b_multinode.sh
doc_options: ["single-node", "multi-node"]
- group: DeepSeek
tag: deepseek
models:
- model: DeepSeek-V2-Lite (16B)
mad_tag: jax_maxtext_train_deepseek-v2-lite-16b
model_repo: DeepSeek-V2-lite
precision: bf16
doc_options: ["single-node"]
- group: Mistral AI
tag: mistral
models:
- model: Mixtral 8x7B
mad_tag: jax_maxtext_train_mixtral-8x7b
model_repo: Mixtral-8x7B
precision: bf16
doc_options: ["single-node"]

View File

@@ -0,0 +1,48 @@
dockers:
- pull_tag: rocm/megatron-lm:v25.8_py310
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.8_py310/images/sha256-50fc824361054e445e86d5d88d5f58817f61f8ec83ad4a7e43ea38bbc4a142c0
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
hipBLASLt: d1b517fc7a
Triton: 3.3.0
RCCL: 2.22.3
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.3 70B
mad_tag: pyt_megatron_lm_train_llama-3.3-70b
- model: Llama 3.1 8B
mad_tag: pyt_megatron_lm_train_llama-3.1-8b
- model: Llama 3.1 70B
mad_tag: pyt_megatron_lm_train_llama-3.1-70b
- model: Llama 3.1 70B (proxy)
mad_tag: pyt_megatron_lm_train_llama-3.1-70b-proxy
- model: Llama 2 7B
mad_tag: pyt_megatron_lm_train_llama-2-7b
- model: Llama 2 70B
mad_tag: pyt_megatron_lm_train_llama-2-70b
- group: DeepSeek
tag: deepseek
models:
- model: DeepSeek-V3 (proxy)
mad_tag: pyt_megatron_lm_train_deepseek-v3-proxy
- model: DeepSeek-V2-Lite
mad_tag: pyt_megatron_lm_train_deepseek-v2-lite-16b
- group: Mistral AI
tag: mistral
models:
- model: Mixtral 8x7B
mad_tag: pyt_megatron_lm_train_mixtral-8x7b
- model: Mixtral 8x22B (proxy)
mad_tag: pyt_megatron_lm_train_mixtral-8x22b-proxy
- group: Qwen
tag: qwen
models:
- model: Qwen 2.5 7B
mad_tag: pyt_megatron_lm_train_qwen2.5-7b
- model: Qwen 2.5 72B
mad_tag: pyt_megatron_lm_train_qwen2.5-72b

View File

@@ -0,0 +1,58 @@
dockers:
- pull_tag: rocm/megatron-lm:v25.8_py310
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.8_py310/images/sha256-50fc824361054e445e86d5d88d5f58817f61f8ec83ad4a7e43ea38bbc4a142c0
components:
ROCm: 6.4.3
Primus: 927a717
PyTorch: 2.8.0a0+gitd06a406
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
hipBLASLt: d1b517fc7a
Triton: 3.3.0
RCCL: 2.22.3
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.3 70B
mad_tag: primus_pyt_megatron_lm_train_llama-3.3-70b
config_name: llama3.3_70B-pretrain.yaml
- model: Llama 3.1 70B
mad_tag: primus_pyt_megatron_lm_train_llama-3.1-70b
config_name: llama3.1_70B-pretrain.yaml
- model: Llama 3.1 8B
mad_tag: primus_pyt_megatron_lm_train_llama-3.1-8b
config_name: llama3.1_8B-pretrain.yaml
- model: Llama 2 7B
mad_tag: primus_pyt_megatron_lm_train_llama-2-7b
config_name: llama2_7B-pretrain.yaml
- model: Llama 2 70B
mad_tag: primus_pyt_megatron_lm_train_llama-2-70b
config_name: llama2_70B-pretrain.yaml
- group: DeepSeek
tag: deepseek
models:
- model: DeepSeek-V3 (proxy)
mad_tag: primus_pyt_megatron_lm_train_deepseek-v3-proxy
config_name: deepseek_v3-pretrain.yaml
- model: DeepSeek-V2-Lite
mad_tag: primus_pyt_megatron_lm_train_deepseek-v2-lite-16b
config_name: deepseek_v2_lite-pretrain.yaml
- group: Mistral AI
tag: mistral
models:
- model: Mixtral 8x7B
mad_tag: primus_pyt_megatron_lm_train_mixtral-8x7b
config_name: mixtral_8x7B_v0.1-pretrain.yaml
- model: Mixtral 8x22B (proxy)
mad_tag: primus_pyt_megatron_lm_train_mixtral-8x22b-proxy
config_name: mixtral_8x22B_v0.1-pretrain.yaml
- group: Qwen
tag: qwen
models:
- model: Qwen 2.5 7B
mad_tag: primus_pyt_megatron_lm_train_qwen2.5-7b
config_name: primus_qwen2.5_7B-pretrain.yaml
- model: Qwen 2.5 72B
mad_tag: primus_pyt_megatron_lm_train_qwen2.5-72b
config_name: qwen2.5_72B-pretrain.yaml

View File

@@ -0,0 +1,24 @@
dockers:
- pull_tag: rocm/pytorch-training:v25.8
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.8/images/sha256-5082ae01d73fec6972b0d84e5dad78c0926820dcf3c19f301d6c8eb892e573c5
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
Python: 3.10.18
Transformer Engine: 2.2.0.dev0+a1e66aae
Flash Attention: 3.0.0.post1
hipBLASLt: 1.1.0-d1b517fc7a
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.1 8B
mad_tag: primus_pyt_train_llama-3.1-8b
model_repo: Llama-3.1-8B
url: https://huggingface.co/meta-llama/Llama-3.1-8B
precision: BF16
- model: Llama 3.1 70B
mad_tag: primus_pyt_train_llama-3.1-70b
model_repo: Llama-3.1-70B
url: https://huggingface.co/meta-llama/Llama-3.1-70B
precision: BF16

View File

@@ -0,0 +1,178 @@
dockers:
- pull_tag: rocm/pytorch-training:v25.8
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.8/images/sha256-5082ae01d73fec6972b0d84e5dad78c0926820dcf3c19f301d6c8eb892e573c5
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
Python: 3.10.18
Transformer Engine: 2.2.0.dev0+a1e66aae
Flash Attention: 3.0.0.post1
hipBLASLt: 1.1.0-d1b517fc7a
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 4 Scout 17B-16E
mad_tag: pyt_train_llama-4-scout-17b-16e
model_repo: Llama-4-17B_16E
url: https://huggingface.co/meta-llama/Llama-4-Scout-17B-16E
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 3.3 70B
mad_tag: pyt_train_llama-3.3-70b
model_repo: Llama-3.3-70B
url: https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct
precision: BF16
training_modes: [finetune_fw, finetune_lora, finetune_qlora]
- model: Llama 3.2 1B
mad_tag: pyt_train_llama-3.2-1b
model_repo: Llama-3.2-1B
url: https://huggingface.co/meta-llama/Llama-3.2-1B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 3.2 3B
mad_tag: pyt_train_llama-3.2-3b
model_repo: Llama-3.2-3B
url: https://huggingface.co/meta-llama/Llama-3.2-3B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 3.2 Vision 11B
mad_tag: pyt_train_llama-3.2-vision-11b
model_repo: Llama-3.2-Vision-11B
url: https://huggingface.co/meta-llama/Llama-3.2-11B-Vision
precision: BF16
training_modes: [finetune_fw]
- model: Llama 3.2 Vision 90B
mad_tag: pyt_train_llama-3.2-vision-90b
model_repo: Llama-3.2-Vision-90B
url: https://huggingface.co/meta-llama/Llama-3.2-90B-Vision
precision: BF16
training_modes: [finetune_fw]
- model: Llama 3.1 8B
mad_tag: pyt_train_llama-3.1-8b
model_repo: Llama-3.1-8B
url: https://huggingface.co/meta-llama/Llama-3.1-8B
precision: BF16
training_modes: [pretrain, finetune_fw, finetune_lora, HF_pretrain]
- model: Llama 3.1 70B
mad_tag: pyt_train_llama-3.1-70b
model_repo: Llama-3.1-70B
url: https://huggingface.co/meta-llama/Llama-3.1-70B-Instruct
precision: BF16
training_modes: [pretrain, finetune_fw, finetune_lora]
- model: Llama 3.1 405B
mad_tag: pyt_train_llama-3.1-405b
model_repo: Llama-3.1-405B
url: https://huggingface.co/meta-llama/Llama-3.1-405B
precision: BF16
training_modes: [finetune_qlora]
- model: Llama 3 8B
mad_tag: pyt_train_llama-3-8b
model_repo: Llama-3-8B
url: https://huggingface.co/meta-llama/Meta-Llama-3-8B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 3 70B
mad_tag: pyt_train_llama-3-70b
model_repo: Llama-3-70B
url: https://huggingface.co/meta-llama/Meta-Llama-3-70B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 2 7B
mad_tag: pyt_train_llama-2-7b
model_repo: Llama-2-7B
url: https://github.com/meta-llama/llama-models/tree/main/models/llama2
precision: BF16
training_modes: [finetune_fw, finetune_lora, finetune_qlora]
- model: Llama 2 13B
mad_tag: pyt_train_llama-2-13b
model_repo: Llama-2-13B
url: https://github.com/meta-llama/llama-models/tree/main/models/llama2
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Llama 2 70B
mad_tag: pyt_train_llama-2-70b
model_repo: Llama-2-70B
url: https://github.com/meta-llama/llama-models/tree/main/models/llama2
precision: BF16
training_modes: [finetune_lora, finetune_qlora]
- group: OpenAI
tag: openai
models:
- model: GPT OSS 20B
mad_tag: pyt_train_gpt_oss_20b
model_repo: GPT-OSS-20B
url: https://huggingface.co/openai/gpt-oss-20b
precision: BF16
training_modes: [HF_finetune_lora]
- model: GPT OSS 120B
mad_tag: pyt_train_gpt_oss_120b
model_repo: GPT-OSS-120B
url: https://huggingface.co/openai/gpt-oss-120b
precision: BF16
training_modes: [HF_finetune_lora]
- group: Qwen
tag: qwen
models:
- model: Qwen 3 8B
mad_tag: pyt_train_qwen3-8b
model_repo: Qwen3-8B
url: https://huggingface.co/Qwen/Qwen3-8B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Qwen 3 32B
mad_tag: pyt_train_qwen3-32b
model_repo: Qwen3-32
url: https://huggingface.co/Qwen/Qwen3-32B
precision: BF16
training_modes: [finetune_lora]
- model: Qwen 2.5 32B
mad_tag: pyt_train_qwen2.5-32b
model_repo: Qwen2.5-32B
url: https://huggingface.co/Qwen/Qwen2.5-32B
precision: BF16
training_modes: [finetune_lora]
- model: Qwen 2.5 72B
mad_tag: pyt_train_qwen2.5-72b
model_repo: Qwen2.5-72B
url: https://huggingface.co/Qwen/Qwen2.5-72B
precision: BF16
training_modes: [finetune_lora]
- model: Qwen 2 1.5B
mad_tag: pyt_train_qwen2-1.5b
model_repo: Qwen2-1.5B
url: https://huggingface.co/Qwen/Qwen2-1.5B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- model: Qwen 2 7B
mad_tag: pyt_train_qwen2-7b
model_repo: Qwen2-7B
url: https://huggingface.co/Qwen/Qwen2-7B
precision: BF16
training_modes: [finetune_fw, finetune_lora]
- group: Stable Diffusion
tag: sd
models:
- model: Stable Diffusion XL
mad_tag: pyt_huggingface_stable_diffusion_xl_2k_lora_finetuning
model_repo: SDXL
url: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
precision: BF16
training_modes: [finetune_lora]
- group: Flux
tag: flux
models:
- model: FLUX.1-dev
mad_tag: pyt_train_flux
model_repo: Flux
url: https://huggingface.co/black-forest-labs/FLUX.1-dev
precision: BF16
training_modes: [pretrain]
- group: NCF
tag: ncf
models:
- model: NCF
mad_tag: pyt_ncf_training
model_repo:
url: https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Recommendation/NCF
precision: FP32

View File

@@ -1,15 +1,22 @@
dockers:
- pull_tag: rocm/megatron-lm:v25.8_py310
docker_hub_url: https://hub.docker.com/layers/rocm/megatron-lm/v25.8_py310/images/sha256-50fc824361054e445e86d5d88d5f58817f61f8ec83ad4a7e43ea38bbc4a142c0
components:
ROCm: 6.4.3
Primus: 927a717
PyTorch: 2.8.0a0+gitd06a406
MI355X and MI350X:
pull_tag: rocm/primus:v25.9_gfx950
docker_hub_url: https://hub.docker.com/layers/rocm/primus/v25.9_gfx950/images/sha256-1a198be32f49efd66d0ff82066b44bd99b3e6b04c8e0e9b36b2c481e13bff7b6
components: &docker_components
ROCm: 7.0.0
Primus: 0.3.0
Primus Turbo: 0.1.1
PyTorch: 2.9.0.dev20250821+rocm7.0.0.lw.git125803b7
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
hipBLASLt: d1b517fc7a
Triton: 3.3.0
RCCL: 2.22.3
Flash Attention: 2.8.3
hipBLASLt: 911283acd1
Triton: 3.4.0+rocm7.0.0.git56765e8c
RCCL: 2.26.6
MI325X and MI300X:
pull_tag: rocm/primus:v25.9_gfx942
docker_hub_url: https://hub.docker.com/layers/rocm/primus/v25.9_gfx942/images/sha256-df6ab8f45b4b9ceb100fb24e19b2019a364e351ee3b324dbe54466a1d67f8357
components: *docker_components
model_groups:
- group: Meta Llama
tag: llama

View File

@@ -1,24 +1,39 @@
dockers:
- pull_tag: rocm/pytorch-training:v25.8
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.8/images/sha256-5082ae01d73fec6972b0d84e5dad78c0926820dcf3c19f301d6c8eb892e573c5
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
Python: 3.10.18
Transformer Engine: 2.2.0.dev0+a1e66aae
Flash Attention: 3.0.0.post1
hipBLASLt: 1.1.0-d1b517fc7a
MI355X and MI350X:
pull_tag: rocm/primus:v25.9_gfx950
docker_hub_url: https://hub.docker.com/layers/rocm/primus/v25.9_gfx950/images/sha256-1a198be32f49efd66d0ff82066b44bd99b3e6b04c8e0e9b36b2c481e13bff7b6
components: &docker_components
ROCm: 7.0.0
Primus: 0.3.0
Primus Turbo: 0.1.1
PyTorch: 2.9.0.dev20250821+rocm7.0.0.lw.git125803b7
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
Flash Attention: 2.8.3
hipBLASLt: 911283acd1
Triton: 3.4.0+rocm7.0.0.git56765e8c
RCCL: 2.26.6
MI325X and MI300X:
pull_tag: rocm/primus:v25.9_gfx942
docker_hub_url: https://hub.docker.com/layers/rocm/primus/v25.9_gfx942/images/sha256-df6ab8f45b4b9ceb100fb24e19b2019a364e351ee3b324dbe54466a1d67f8357
components: *docker_components
model_groups:
- group: Meta Llama
tag: llama
models:
- model: Llama 3.1 8B
mad_tag: primus_pyt_train_llama-3.1-8b
model_repo: Llama-3.1-8B
model_repo: meta-llama/Llama-3.1-8B
url: https://huggingface.co/meta-llama/Llama-3.1-8B
precision: BF16
config_file:
bf16: "./llama3_8b_fsdp_bf16.toml"
fp8: "./llama3_8b_fsdp_fp8.toml"
- model: Llama 3.1 70B
mad_tag: primus_pyt_train_llama-3.1-70b
model_repo: Llama-3.1-70B
model_repo: meta-llama/Llama-3.1-70B
url: https://huggingface.co/meta-llama/Llama-3.1-70B
precision: BF16
config_file:
bf16: "./llama3_70b_fsdp_bf16.toml"
fp8: "./llama3_70b_fsdp_fp8.toml"

View File

@@ -1,13 +1,21 @@
dockers:
- pull_tag: rocm/pytorch-training:v25.8
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.8/images/sha256-5082ae01d73fec6972b0d84e5dad78c0926820dcf3c19f301d6c8eb892e573c5
components:
ROCm: 6.4.3
PyTorch: 2.8.0a0+gitd06a406
Python: 3.10.18
Transformer Engine: 2.2.0.dev0+a1e66aae
Flash Attention: 3.0.0.post1
hipBLASLt: 1.1.0-d1b517fc7a
MI355X and MI350X:
pull_tag: rocm/pytorch-training:v25.9_gfx950
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.9_gfx950/images/sha256-1a198be32f49efd66d0ff82066b44bd99b3e6b04c8e0e9b36b2c481e13bff7b6
components: &docker_components
ROCm: 7.0.0
Primus: aab4234
PyTorch: 2.9.0.dev20250821+rocm7.0.0.lw.git125803b7
Python: "3.10"
Transformer Engine: 2.2.0.dev0+54dd2bdc
Flash Attention: 2.8.3
hipBLASLt: 911283acd1
Triton: 3.4.0+rocm7.0.0.git56765e8c
RCCL: 2.26.6
MI325X and MI300X:
pull_tag: rocm/pytorch-training:v25.9_gfx942
docker_hub_url: https://hub.docker.com/layers/rocm/pytorch-training/v25.9_gfx942/images/sha256-df6ab8f45b4b9ceb100fb24e19b2019a364e351ee3b324dbe54466a1d67f8357
components: *docker_components
model_groups:
- group: Meta Llama
tag: llama
@@ -158,7 +166,7 @@ model_groups:
model_repo: SDXL
url: https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
precision: BF16
training_modes: [finetune_lora]
training_modes: [posttrain-p]
- group: Flux
tag: flux
models:
@@ -167,7 +175,7 @@ model_groups:
model_repo: Flux
url: https://huggingface.co/black-forest-labs/FLUX.1-dev
precision: BF16
training_modes: [pretrain]
training_modes: [posttrain-p]
- group: NCF
tag: ncf
models:

View File

@@ -1,4 +1,4 @@
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X series,MI300A,MI350X series
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X Series,MI300A,MI350X Series
32 bit atomicAdd,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
32 bit atomicSub,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
32 bit atomicMin,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
1 Atomic MI100 MI200 PCIe MI200 A+A MI300X series MI300X Series MI300A MI350X series MI350X Series
2 32 bit atomicAdd ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS
3 32 bit atomicSub ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS
4 32 bit atomicMin ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS

View File

@@ -1,4 +1,4 @@
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X series,MI300A,MI350X series
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X Series,MI300A,MI350X Series
32 bit atomicAdd,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
32 bit atomicSub,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
32 bit atomicMin,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS,✅ CAS
1 Atomic MI100 MI200 PCIe MI200 A+A MI300X series MI300X Series MI300A MI350X series MI350X Series
2 32 bit atomicAdd ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS
3 32 bit atomicSub ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS
4 32 bit atomicMin ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS ✅ CAS

View File

@@ -1,4 +1,4 @@
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X series,MI300A,MI350X series
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X Series,MI300A,MI350X Series
32 bit atomicAdd,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
32 bit atomicSub,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
32 bit atomicMin,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
1 Atomic MI100 MI200 PCIe MI200 A+A MI300X series MI300X Series MI300A MI350X series MI350X Series
2 32 bit atomicAdd ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native
3 32 bit atomicSub ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native
4 32 bit atomicMin ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native

View File

@@ -1,4 +1,4 @@
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X series,MI300A,MI350X series
Atomic,MI100,MI200 PCIe,MI200 A+A,MI300X Series,MI300A,MI350X Series
32 bit atomicAdd,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
32 bit atomicSub,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
32 bit atomicMin,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native,✅ Native
1 Atomic MI100 MI200 PCIe MI200 A+A MI300X series MI300X Series MI300A MI350X series MI350X Series
2 32 bit atomicAdd ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native
3 32 bit atomicSub ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native
4 32 bit atomicMin ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native ✅ Native

View File

@@ -0,0 +1,366 @@
:orphan:
.. meta::
:description: How to train a model using JAX MaxText for ROCm.
:keywords: ROCm, AI, LLM, train, jax, torch, Llama, flux, tutorial, docker
******************************************
Training a model with JAX MaxText on ROCm
******************************************
.. caution::
This documentation does not reflect the latest version of ROCm JAX MaxText
training performance documentation. See :doc:`../jax-maxtext` for the latest version.
MaxText is a high-performance, open-source framework built on the Google JAX
machine learning library to train LLMs at scale. The MaxText framework for
ROCm is an optimized fork of the upstream
`<https://github.com/AI-Hypercomputer/maxtext>`__ enabling efficient AI workloads
on AMD MI300X series GPUs.
The MaxText for ROCm training Docker image
provides a prebuilt environment for training on AMD Instinct MI300X and MI325X GPUs,
including essential components like JAX, XLA, ROCm libraries, and MaxText utilities.
It includes the following software components:
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/jax-maxtext-benchmark-models.yaml
{% set dockers = data.dockers %}
.. tab-set::
{% for docker in dockers %}
{% set jax_version = docker.components["JAX"] %}
.. tab-item:: ``{{ docker.pull_tag }}``
:sync: {{ docker.pull_tag }}
.. list-table::
:header-rows: 1
* - Software component
- Version
{% for component_name, component_version in docker.components.items() %}
* - {{ component_name }}
- {{ component_version }}
{% endfor %}
{% if jax_version == "0.6.0" %}
.. note::
Shardy is a new config in JAX 0.6.0. You might get related errors if it's
not configured correctly. For now you can turn it off by setting
``shardy=False`` during the training run. You can also follow the `migration
guide <https://docs.jax.dev/en/latest/shardy_jax_migration.html>`__ to enable
it.
{% endif %}
{% endfor %}
MaxText with on ROCm provides the following key features to train large language models efficiently:
- Transformer Engine (TE)
- Flash Attention (FA) 3 -- with or without sequence input packing
- GEMM tuning
- Multi-node support
- NANOO FP8 quantization support
.. _amd-maxtext-model-support-v257:
Supported models
================
The following models are pre-optimized for performance on AMD Instinct MI300
series GPUs. Some instructions, commands, and available training
configurations in this documentation might vary by model -- select one to get
started.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/jax-maxtext-benchmark-models.yaml
{% set model_groups = data.model_groups %}
.. raw:: html
<div id="vllm-benchmark-ud-params-picker" class="container-fluid">
<div class="row gx-0">
<div class="col-2 me-1 px-2 model-param-head">Model</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
<div class="col-4 px-2 model-param" data-param-k="model-group" data-param-v="{{ model_group.tag }}" tabindex="0">{{ model_group.group }}</div>
{% endfor %}
</div>
</div>
<div class="row gx-0 pt-1">
<div class="col-2 me-1 px-2 model-param-head">Variant</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
{% set models = model_group.models %}
{% for model in models %}
{% if models|length % 3 == 0 %}
<div class="col-4 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% else %}
<div class="col-6 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
</div>
.. note::
Some models, such as Llama 3, require an external license agreement through
a third party (for example, Meta).
System validation
=================
Before running AI workloads, it's important to validate that your AMD hardware is configured
correctly and performing optimally.
If you have already validated your system settings, including aspects like NUMA auto-balancing, you
can skip this step. Otherwise, complete the procedures in the :ref:`System validation and
optimization <rocm-for-ai-system-optimization>` guide to properly configure your system settings
before starting training.
To test for optimal performance, consult the recommended :ref:`System health benchmarks
<rocm-for-ai-system-health-bench>`. This suite of tests will help you verify and fine-tune your
system's configuration.
Environment setup
=================
This Docker image is optimized for specific model configurations outlined
as follows. Performance can vary for other training workloads, as AMD
doesnt validate configurations and run conditions outside those described.
Pull the Docker image
---------------------
Use the following command to pull the Docker image from Docker Hub.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/jax-maxtext-benchmark-models.yaml
{% set dockers = data.dockers %}
.. tab-set::
{% for docker in dockers %}
{% set jax_version = docker.components["JAX"] %}
.. tab-item:: JAX {{ jax_version }}
:sync: {{ docker.pull_tag }}
.. code-block:: shell
docker pull {{ docker.pull_tag }}
{% endfor %}
.. _amd-maxtext-multi-node-setup-v257:
Multi-node configuration
------------------------
See :doc:`/how-to/rocm-for-ai/system-setup/multi-node-setup` to configure your
environment for multi-node training.
.. _amd-maxtext-get-started-v257:
Benchmarking
============
Once the setup is complete, choose between two options to reproduce the
benchmark results:
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/jax-maxtext-benchmark-models.yaml
.. _vllm-benchmark-mad:
{% set dockers = data.dockers %}
{% set model_groups = data.model_groups %}
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{model.mad_tag}}
.. tab-set::
{% if model.mad_tag and "single-node" in model.doc_options %}
.. tab-item:: MAD-integrated benchmarking
1. Clone the ROCm Model Automation and Dashboarding (`<https://github.com/ROCm/MAD>`__) repository to a local
directory and install the required packages on the host machine.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD
pip install -r requirements.txt
2. Use this command to run the performance benchmark test on the {{ model.model }} model
using one GPU with the :literal:`{{model.precision}}` data type on the host machine.
.. code-block:: shell
export MAD_SECRETS_HFTOKEN="your personal Hugging Face token to access gated models"
madengine run \
--tags {{model.mad_tag}} \
--keep-model-dir \
--live-output \
--timeout 28800
MAD launches a Docker container with the name
``container_ci-{{model.mad_tag}}``. The latency and throughput reports of the
model are collected in the following path: ``~/MAD/perf.csv/``.
{% endif %}
.. tab-item:: Standalone benchmarking
.. rubric:: Download the Docker image and required scripts
Run the JAX MaxText benchmark tool independently by starting the
Docker container as shown in the following snippet.
.. tab-set::
{% for docker in dockers %}
{% set jax_version = docker.components["JAX"] %}
.. tab-item:: JAX {{ jax_version }}
:sync: {{ docker.pull_tag }}
.. code-block:: shell
docker pull {{ docker.pull_tag }}
{% endfor %}
{% if model.model_repo and "single-node" in model.doc_options %}
.. rubric:: Single node training
1. Set up environment variables.
.. code-block:: shell
export MAD_SECRETS_HFTOKEN=<Your Hugging Face token>
export HF_HOME=<Location of saved/cached Hugging Face models>
``MAD_SECRETS_HFTOKEN`` is your Hugging Face access token to access models, tokenizers, and data.
See `User access tokens <https://huggingface.co/docs/hub/en/security-tokens>`__.
``HF_HOME`` is where ``huggingface_hub`` will store local data. See `huggingface_hub CLI <https://huggingface.co/docs/huggingface_hub/main/en/guides/cli#huggingface-cli-download>`__.
If you already have downloaded or cached Hugging Face artifacts, set this variable to that path.
Downloaded files typically get cached to ``~/.cache/huggingface``.
2. Launch the Docker container.
.. tab-set::
{% for docker in dockers %}
{% set jax_version = docker.components["JAX"] %}
.. tab-item:: JAX {{ jax_version }}
:sync: {{ docker.pull_tag }}
.. code-block:: shell
docker run -it \
--device=/dev/dri \
--device=/dev/kfd \
--network host \
--ipc host \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--privileged \
-v $HOME:$HOME \
-v $HOME/.ssh:/root/.ssh \
-v $HF_HOME:/hf_cache \
-e HF_HOME=/hf_cache \
-e MAD_SECRETS_HFTOKEN=$MAD_SECRETS_HFTOKEN
--shm-size 64G \
--name training_env \
{{ docker.pull_tag }}
{% endfor %}
3. In the Docker container, clone the ROCm MAD repository and navigate to the
benchmark scripts directory at ``MAD/scripts/jax-maxtext``.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD/scripts/jax-maxtext
4. Run the setup scripts to install libraries and datasets needed
for benchmarking.
.. code-block:: shell
./jax-maxtext_benchmark_setup.sh -m {{ model.model_repo }}
5. To run the training benchmark without quantization, use the following command:
.. code-block:: shell
./jax-maxtext_benchmark_report.sh -m {{ model.model_repo }}
For quantized training, use the following command:
.. code-block:: shell
./jax-maxtext_benchmark_report.sh -m {{ model.model_repo }} -q nanoo_fp8
{% endif %}
{% if model.multinode_training_script and "multi-node" in model.doc_options %}
.. rubric:: Multi-node training
The following examples use SLURM to run on multiple nodes.
.. note::
The following scripts will launch the Docker container and run the
benchmark. Run them outside of any Docker container.
1. Make sure ``$HF_HOME`` is set before running the test. See
`ROCm benchmarking <https://github.com/ROCm/MAD/blob/develop/scripts/jax-maxtext/gpu-rocm/readme.md>`__
for more details on downloading the Llama models before running the
benchmark.
2. To run multi-node training for {{ model.model }},
use the
`multi-node training script <https://github.com/ROCm/MAD/blob/develop/scripts/jax-maxtext/gpu-rocm/{{ model.multinode_training_script }}>`__
under the ``scripts/jax-maxtext/gpu-rocm/`` directory.
3. Run the multi-node training benchmark script.
.. code-block:: shell
sbatch -N <num_nodes> {{ model.multinode_training_script }}
{% else %}
.. rubric:: Multi-node training
For multi-node training examples, choose a model from :ref:`amd-maxtext-model-support-v257`
with an available `multi-node training script <https://github.com/ROCm/MAD/tree/develop/scripts/jax-maxtext/gpu-rocm>`__.
{% endif %}
{% endfor %}
{% endfor %}
Further reading
===============
- To learn more about MAD and the ``madengine`` CLI, see the `MAD usage guide <https://github.com/ROCm/MAD?tab=readme-ov-file#usage-guide>`__.
- To learn more about system settings and management practices to configure your system for
AMD Instinct MI300X series GPUs, see `AMD Instinct MI300X system optimization <https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300x.html>`_.
- For a list of other ready-made Docker images for AI with ROCm, see
`AMD Infinity Hub <https://www.amd.com/en/developer/resources/infinity-hub.html#f-amd_hub_category=AI%20%26%20ML%20Models>`_.
Previous versions
=================
See :doc:`jax-maxtext-history` to find documentation for previous releases
of the ``ROCm/jax-training`` Docker image.

View File

@@ -0,0 +1,667 @@
:orphan:
.. meta::
:description: How to train a model using Megatron-LM for ROCm.
:keywords: ROCm, AI, LLM, train, Megatron-LM, megatron, Llama, tutorial, docker, torch
********************************************
Training a model with Primus and Megatron-LM
********************************************
.. caution::
This documentation does not reflect the latest version of ROCm Megatron-LM
training performance documentation. See :doc:`../primus-megatron` for the latest version.
`Primus <https://github.com/AMD-AGI/Primus>`__ is a unified and flexible
LLM training framework designed to streamline training. It streamlines LLM
training on AMD Instinct GPUs using a modular, reproducible configuration paradigm.
Primus is backend-agnostic and supports multiple training engines -- including Megatron.
.. note::
Primus with Megatron is designed to replace the :doc:`ROCm Megatron-LM training <../megatron-lm>` workflow.
To learn how to migrate workloads from Megatron-LM to Primus with Megatron,
see :doc:`megatron-lm-primus-migration-guide`.
For ease of use, AMD provides a ready-to-use Docker image for MI300 series GPUs
containing essential components for Primus and Megatron-LM. This Docker is powered by Primus
Turbo optimizations for performance; this release adds support for Primus Turbo
with optimized attention and grouped GEMM kernels.
.. note::
This Docker environment is based on Python 3.10 and Ubuntu 22.04. For an alternative environment with
Python 3.12 and Ubuntu 24.04, see the :doc:`previous ROCm Megatron-LM v25.6 Docker release <megatron-lm-v25.6>`.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-megatron-v25.8-benchmark-models.yaml
{% set dockers = data.dockers %}
{% set docker = dockers[0] %}
.. list-table::
:header-rows: 1
* - Software component
- Version
{% for component_name, component_version in docker.components.items() %}
* - {{ component_name }}
- {{ component_version }}
{% endfor %}
.. _amd-primus-megatron-lm-model-support:
Supported models
================
The following models are pre-optimized for performance on AMD Instinct MI300X series GPUs.
Some instructions, commands, and training examples in this documentation might
vary by model -- select one to get started.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-megatron-v25.8-benchmark-models.yaml
{% set model_groups = data.model_groups %}
.. raw:: html
<div id="vllm-benchmark-ud-params-picker" class="container-fluid">
<div class="row gx-0">
<div class="col-2 me-1 px-2 model-param-head">Model</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
<div class="col-3 px-2 model-param" data-param-k="model-group" data-param-v="{{ model_group.tag }}" tabindex="0">{{ model_group.group }}</div>
{% endfor %}
</div>
</div>
<div class="row gx-0 pt-1">
<div class="col-2 me-1 px-2 model-param-head">Variant</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
{% set models = model_group.models %}
{% for model in models %}
{% if models|length % 3 == 0 %}
<div class="col-4 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% else %}
<div class="col-6 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
</div>
.. note::
Some models, such as Llama, require an external license agreement through
a third party (for example, Meta).
System validation
=================
Before running AI workloads, it's important to validate that your AMD hardware is configured
correctly and performing optimally.
If you have already validated your system settings, including aspects like NUMA auto-balancing, you
can skip this step. Otherwise, complete the procedures in the :ref:`System validation and
optimization <rocm-for-ai-system-optimization>` guide to properly configure your system settings
before starting training.
To test for optimal performance, consult the recommended :ref:`System health benchmarks
<rocm-for-ai-system-health-bench>`. This suite of tests will help you verify and fine-tune your
system's configuration.
.. _mi300x-amd-primus-megatron-lm-training:
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-megatron-v25.8-benchmark-models.yaml
{% set dockers = data.dockers %}
{% set docker = dockers[0] %}
Environment setup
=================
Use the following instructions to set up the environment, configure the script to train models, and
reproduce the benchmark results on MI300X series GPUs with the ``{{ docker.pull_tag }}`` image.
.. _amd-primus-megatron-lm-requirements:
Download the Docker image
-------------------------
1. Use the following command to pull the Docker image from Docker Hub.
.. code-block:: shell
docker pull {{ docker.pull_tag }}
2. Launch the Docker container.
.. code-block:: shell
docker run -it \
--device /dev/dri \
--device /dev/kfd \
--device /dev/infiniband \
--network host --ipc host \
--group-add video \
--cap-add SYS_PTRACE \
--security-opt seccomp=unconfined \
--privileged \
-v $HOME:$HOME \
--shm-size 128G \
--name primus_training_env \
{{ docker.pull_tag }}
3. Use these commands if you exit the ``primus_training_env`` container and need to return to it.
.. code-block:: shell
docker start primus_training_env
docker exec -it primus_training_env bash
The Docker container hosts verified commit ``927a717`` of the `Primus
<https://github.com/AMD-AGI/Primus/tree/927a71702784347a311ca48fd45f0f308c6ef6dd>`__ repository.
.. _amd-primus-megatron-lm-environment-setup:
Configuration
=============
Primus defines a training configuration in YAML for each model in
`examples/megatron/configs <https://github.com/AMD-AGI/Primus/tree/927a71702784347a311ca48fd45f0f308c6ef6dd/examples/megatron/configs>`__.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-megatron-v25.8-benchmark-models.yaml
{% set model_groups = data.model_groups %}
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{ model.mad_tag }}
To update training parameters for {{ model.model }}, you can update ``examples/megatron/configs/{{ model.config_name }}``.
Note that training configuration YAML files for other models follow this naming convention.
{% endfor %}
{% endfor %}
.. note::
See :ref:`Key options <amd-primus-megatron-lm-benchmark-test-vars>` for more information on configuration options.
Dataset options
---------------
You can use either mock data or real data for training.
* Mock data can be useful for testing and validation. Use the ``mock_data`` field to toggle between mock and real data. The default
value is ``true`` for enabled.
.. code-block:: yaml
mock_data: true
* If you're using a real dataset, update the ``train_data_path`` field to point to the location of your dataset.
.. code-block:: bash
mock_data: false
train_data_path: /path/to/your/dataset
Ensure that the files are accessible inside the Docker container.
.. _amd-primus-megatron-lm-tokenizer:
Tokenizer
---------
Set the ``HF_TOKEN`` environment variable with
right permissions to access the tokenizer for each model.
.. code-block:: bash
# Export your HF_TOKEN in the workspace
export HF_TOKEN=<your_hftoken>
.. note::
In Primus, each model uses a tokenizer from Hugging Face. For example, Llama
3.1 8B model uses ``tokenizer_model: meta-llama/Llama-3.1-8B`` and
``tokenizer_type: Llama3Tokenizer`` defined in the `llama3.1-8B model
<https://github.com/AMD-AGI/Primus/blob/927a71702784347a311ca48fd45f0f308c6ef6dd/examples/megatron/configs/llama3.1_8B-pretrain.yaml>`__
definition.
.. _amd-primus-megatron-lm-run-training:
Run training
============
Use the following example commands to set up the environment, configure
:ref:`key options <amd-primus-megatron-lm-benchmark-test-vars>`, and run training on
MI300X series GPUs with the AMD Megatron-LM environment.
Single node training
--------------------
To run training on a single node, navigate to ``/workspace/Primus`` and use the following setup command:
.. code-block:: shell
pip install -r requirements.txt
export HSA_NO_SCRATCH_RECLAIM=1
export NVTE_CK_USES_BWD_V3=1
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.3-70b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Llama 3.3 70B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run pre-training for Llama 3.3 70B BF16, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama3.3_70B-pretrain.yaml \
bash ./examples/run_pretrain.sh \
--micro_batch_size 2 \
--global_batch_size 16 \
--train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.1-8b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Llama 3.1 8B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run pre-training for Llama 3.1 8B FP8, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama3.1_8B-pretrain.yaml \
bash ./examples/run_pretrain.sh \
--train_iters 50 \
--fp8 hybrid
For Llama 3.1 8B BF16, use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/llama3.1_8B-pretrain.yaml \
bash ./examples/run_pretrain.sh --train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.1-70b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Llama 3.1 70B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run pre-training for Llama 3.1 70B BF16, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama3.1_70B-pretrain.yaml \
bash ./examples/run_pretrain.sh \
--train_iters 50
To run the training on a single node for Llama 3.1 70B FP8 with proxy, use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/llama3.1_70B-pretrain.yaml \
bash ./examples/run_pretrain.sh \
--train_iters 50 \
--num_layers 40 \
--fp8 hybrid
.. note::
Use two or more nodes to run the *full* Llama 70B model with FP8 precision.
.. container:: model-doc primus_pyt_megatron_lm_train_llama-2-7b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Llama 2 7B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run pre-training for Llama 2 7B FP8, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama2_7B-pretrain.yaml \
bash ./examples/run_pretrain.sh \
--train_iters 50 \
--fp8 hybrid
To run pre-training for Llama 2 7B BF16, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama2_7B-pretrain.yaml \
bash ./examples/run_pretrain.sh --train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_llama-2-70b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Llama 2 70B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run pre-training for Llama 2 70B BF16, run:
.. code-block:: shell
EXP=examples/megatron/configs/llama2_70B-pretrain.yaml \
bash ./examples/run_pretrain.sh --train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_deepseek-v3-proxy
Once setup is complete, run the appropriate training command.
The following run commands are tailored to DeepSeek-V3.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run training on a single node for DeepSeek-V3 (MoE with expert parallel) with 3-layer proxy,
use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/deepseek_v3-pretrain.yaml \
bash examples/run_pretrain.sh \
--num_layers 3 \
--moe_layer_freq 1 \
--train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_deepseek-v2-lite-16b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to DeepSeek-V2-Lite.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run training on a single node for DeepSeek-V2-Lite (MoE with expert parallel),
use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/deepseek_v2_lite-pretrain.yaml \
bash examples/run_pretrain.sh \
--global_batch_size 256 \
--train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_mixtral-8x7b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Mixtral 8x7B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run training on a single node for Mixtral 8x7B (MoE with expert parallel),
use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/mixtral_8x7B_v0.1-pretrain.yaml \
bash examples/run_pretrain.sh --train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_mixtral-8x22b-proxy
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Mixtral 8x22B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run training on a single node for Mixtral 8x22B (MoE with expert parallel) with 4-layer proxy,
use the following command:
.. code-block:: shell
EXP=examples/megatron/configs/mixtral_8x22B_v0.1-pretrain.yaml \
bash examples/run_pretrain.sh \
--num_layers 4 \
--pipeline_model_parallel_size 1 \
--micro_batch_size 1 \
--global_batch_size 16 \
--train_iters 50
.. container:: model-doc primus_pyt_megatron_lm_train_qwen2.5-7b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Qwen 2.5 7B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run training on a single node for Qwen 2.5 7B BF16, use the following
command:
.. code-block:: shell
EXP=examples/megatron/configs/qwen2.5_7B-pretrain.yaml \
bash examples/run_pretrain.sh --train_iters 50
For FP8, use the following command.
.. code-block:: shell
EXP=examples/megatron/configs/qwen2.5_7B-pretrain.yaml \
bash examples/run_pretrain.sh \
--train_iters 50 \
--fp8 hybrid
.. container:: model-doc primus_pyt_megatron_lm_train_qwen2.5-72b
Once setup is complete, run the appropriate training command.
The following run commands are tailored to Qwen 2.5 72B.
See :ref:`amd-primus-megatron-lm-model-support` to switch to another available model.
To run the training on a single node for Qwen 2.5 72B BF16, use the following command.
.. code-block:: shell
EXP=examples/megatron/configs/qwen2.5_72B-pretrain.yaml \
bash examples/run_pretrain.sh --train_iters 50
.. _amd-primus-megatron-multi-node-examples:
Multi-node training examples
----------------------------
Refer to :doc:`/how-to/rocm-for-ai/system-setup/multi-node-setup` to configure your environment for multi-node
training.
To run training on multiple nodes, you can use the
`run_slurm_pretrain.sh <https://github.com/AMD-AGI/Primus/blob/927a71702784347a311ca48fd45f0f308c6ef6dd/examples/run_slurm_pretrain.sh>`__
to launch the multi-node workload. Use the following steps to setup your environment:
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-megatron-v25.8-benchmark-models.yaml
{% set dockers = data.dockers %}
{% set docker = dockers[0] %}
.. code-block:: shell
cd /workspace/Primus/
export DOCKER_IMAGE={{ docker.pull_tag }}
export HF_TOKEN=<your_HF_token>
export HSA_NO_SCRATCH_RECLAIM=1
export NVTE_CK_USES_BWD_V3=1
export NCCL_IB_HCA=<your_NCCL_IB_HCA> # specify which RDMA interfaces to use for communication
export NCCL_SOCKET_IFNAME=<your_NCCL_SOCKET_IFNAME> # your Network Interface
export GLOO_SOCKET_IFNAME=<your_GLOO_SOCKET_IFNAME> # your Network Interface
export NCCL_IB_GID_INDEX=3 # Set InfiniBand GID index for NCCL communication. Default is 3 for ROCE
.. note::
* Make sure correct network drivers are installed on the nodes. If inside a Docker, either install the drivers inside the Docker container or pass the network drivers from the host while creating Docker container.
* If ``NCCL_IB_HCA`` and ``NCCL_SOCKET_IFNAME`` are not set, Primus will try to auto-detect. However, since NICs can vary accross different cluster, it is encouraged to explicitly export your NCCL parameters for the cluster.
* To find your network interface, you can use ``ip a``.
* To find RDMA interfaces, you can use ``ibv_devices`` to get the list of all the RDMA/IB devices.
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.3-70b
To train Llama 3.3 70B FP8 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama3.3_70B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 1 \
--global_batch_size 256 \
--recompute_num_layers 80 \
--fp8 hybrid
To train Llama 3.3 70B BF16 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama3.3_70B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 1 \
--global_batch_size 256 \
--recompute_num_layers 12
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.1-8b
To train Llama 3.1 8B FP8 on 8 nodes, run:
.. code-block:: shell
# Adjust the training parameters. For e.g., `global_batch_size: 8 * #single_node_bs` for 8 nodes in this case
NNODES=8 EXP=examples/megatron/configs/llama3.1_8B-pretrain.yaml \
bash ./examples/run_slurm_pretrain.sh \
--global_batch_size 1024 \
--fp8 hybrid
.. container:: model-doc primus_pyt_megatron_lm_train_llama-3.1-70b
To train Llama 3.1 70B FP8 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama3.1_70B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 1 \
--global_batch_size 256 \
--recompute_num_layers 80 \
--fp8 hybrid
To train Llama 3.1 70B BF16 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama3.1_70B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 1 \
--global_batch_size 256 \
--recompute_num_layers 12
.. container:: model-doc primus_pyt_megatron_lm_train_llama-2-7b
To train Llama 2 8B FP8 on 8 nodes, run:
.. code-block:: shell
# Adjust the training parameters. For e.g., `global_batch_size: 8 * #single_node_bs` for 8 nodes in this case
NNODES=8 EXP=examples/megatron/configs/llama2_7B-pretrain.yaml bash ./examples/run_slurm_pretrain.sh --global_batch_size 2048 --fp8 hybrid
.. container:: model-doc primus_pyt_megatron_lm_train_llama-2-70b
To train Llama 2 70B FP8 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama2_70B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 2 \
--global_batch_size 256 \
--recompute_num_layers 80 \
--fp8 hybrid
To train Llama 2 70B BF16 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/llama2_70B-pretrain.yaml \
bash ./examples/run_slurm_pretrain.sh \
--micro_batch_size 2 \
--global_batch_size 1536 \
--recompute_num_layers 12
.. container:: model-doc primus_pyt_megatron_lm_train_mixtral-8x7b
To train Mixtral 8x7B BF16 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/mixtral_8x7B_v0.1-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 2 \
--global_batch_size 256
.. container:: model-doc primus_pyt_megatron_lm_train_qwen2.5-72b
To train Qwen2.5 72B FP8 on 8 nodes, run:
.. code-block:: shell
NNODES=8 EXP=examples/megatron/configs/qwen2.5_72B-pretrain.yaml \
bash examples/run_slurm_pretrain.sh \
--micro_batch_size 4 \
--global_batch_size 256 \
--recompute_num_layers 80 \
--fp8 hybrid
.. _amd-primus-megatron-lm-benchmark-test-vars:
Key options
-----------
The following are key options to take note of
fp8
``hybrid`` enables FP8 GEMMs.
use_torch_fsdp2
``use_torch_fsdp2: 1`` enables torch fsdp-v2. If FSDP is enabled,
set ``use_distributed_optimizer`` and ``overlap_param_gather`` to ``false``.
profile
To enable PyTorch profiling, set these parameters:
.. code-block:: yaml
profile: true
use_pytorch_profiler: true
profile_step_end: 7
profile_step_start: 6
train_iters
The total number of iterations (default: 50).
mock_data
True by default.
micro_batch_size
Micro batch size.
global_batch_size
Global batch size.
recompute_granularity
For activation checkpointing.
num_layers
For using a reduced number of layers as with proxy models.
Further reading
===============
- For an introduction to Primus, see `Primus: A Lightweight, Unified Training
Framework for Large Models on AMD GPUs <https://rocm.blogs.amd.com/software-tools-optimization/primus/README.html>`__.
- To learn more about system settings and management practices to configure your system for
AMD Instinct MI300X series GPUs, see `AMD Instinct MI300X system optimization <https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300x.html>`_.
- For a list of other ready-made Docker images for AI with ROCm, see
`AMD Infinity Hub <https://www.amd.com/en/developer/resources/infinity-hub.html#f-amd_hub_category=AI%20%26%20ML%20Models>`_.
Previous versions
=================
See :doc:`megatron-lm-history` to find documentation for previous releases
of the ``ROCm/megatron-lm`` Docker image.
This training environment now uses Primus with Megatron as the primary
configuration. Limited support for the legacy ROCm Megatron-LM is still
available; see the :doc:`../megatron-lm` documentation.

View File

@@ -0,0 +1,312 @@
:orphan:
.. meta::
:description: How to train a model using PyTorch for ROCm.
:keywords: ROCm, AI, LLM, train, PyTorch, torch, Llama, flux, tutorial, docker
****************************************
Training a model with Primus and PyTorch
****************************************
.. caution::
This documentation does not reflect the latest version of ROCm Primus PyTorch training
performance benchmark documentation. See :doc:`../primus-pytorch` for the latest version.
`Primus <https://github.com/AMD-AGI/Primus>`__ is a unified and flexible
LLM training framework designed to streamline training. It streamlines LLM
training on AMD Instinct GPUs using a modular, reproducible configuration paradigm.
Primus now supports the PyTorch torchtitan backend.
.. note::
Primus with the PyTorch torchtitan backend is designed to replace the :doc:`ROCm PyTorch training <../pytorch-training>` workflow.
See :doc:`../pytorch-training` to see steps to run workloads without Primus.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-pytorch-v25.8-benchmark-models.yaml
{% set dockers = data.dockers %}
{% set docker = dockers[0] %}
For ease of use, AMD provides a ready-to-use Docker image -- ``{{
docker.pull_tag }}`` -- for MI300X series GPUs containing essential
components for Primus and PyTorch training with
Primus Turbo optimizations.
.. list-table::
:header-rows: 1
* - Software component
- Version
{% for component_name, component_version in docker.components.items() %}
* - {{ component_name }}
- {{ component_version }}
{% endfor %}
.. _amd-primus-pytorch-model-support-v258:
Supported models
================
The following models are pre-optimized for performance on the AMD Instinct MI325X and MI300X GPUs.
Some instructions, commands, and training recommendations in this documentation might
vary by model -- select one to get started.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-pytorch-v25.8-benchmark-models.yaml
{% set unified_docker = data.dockers[0] %}
{% set model_groups = data.model_groups %}
.. raw:: html
<div id="vllm-benchmark-ud-params-picker" class="container-fluid">
<div class="row gx-0" style="display: none;">
<div class="col-2 me-1 px-2 model-param-head">Model</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
<div class="col-3 px-2 model-param" data-param-k="model-group" data-param-v="{{ model_group.tag }}" tabindex="0">{{ model_group.group }}</div>
{% endfor %}
</div>
</div>
<div class="row gx-0 pt-1">
<div class="col-2 me-1 px-2 model-param-head">Model</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
{% set models = model_group.models %}
{% for model in models %}
{% if models|length % 3 == 0 %}
<div class="col-4 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% else %}
<div class="col-6 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
</div>
.. seealso::
For additional workloads, including Llama 3.3, Llama 3.2, Llama 2, GPT OSS, Qwen, and Flux models,
see the documentation :doc:`../pytorch-training` (without Primus)
.. _amd-primus-pytorch-performance-measurements-v258:
System validation
=================
Before running AI workloads, it's important to validate that your AMD hardware is configured
correctly and performing optimally.
If you have already validated your system settings, including aspects like NUMA auto-balancing, you
can skip this step. Otherwise, complete the procedures in the :ref:`System validation and
optimization <rocm-for-ai-system-optimization>` guide to properly configure your system settings
before starting training.
To test for optimal performance, consult the recommended :ref:`System health benchmarks
<rocm-for-ai-system-health-bench>`. This suite of tests will help you verify and fine-tune your
system's configuration.
This Docker image is optimized for specific model configurations outlined
below. Performance can vary for other training workloads, as AMD
doesnt test configurations and run conditions outside those described.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/primus-pytorch-v25.8-benchmark-models.yaml
{% set unified_docker = data.dockers[0] %}
Pull the Docker image
=====================
Use the following command to pull the `Docker image <{{ unified_docker.docker_hub_url }}>`_ from Docker Hub.
.. code-block:: shell
docker pull {{ unified_docker.pull_tag }}
Run training
============
{% set model_groups = data.model_groups %}
Once the setup is complete, choose between the following two workflows to start benchmarking training.
For fine-tuning workloads and multi-node training examples, see :doc:`../pytorch-training` (without Primus).
.. tab-set::
.. tab-item:: MAD-integrated benchmarking
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{ model.mad_tag }}
The following run command is tailored to {{ model.model }}.
See :ref:`amd-primus-pytorch-model-support-v258` to switch to another available model.
1. Clone the ROCm Model Automation and Dashboarding (`<https://github.com/ROCm/MAD>`__) repository to a local
directory and install the required packages on the host machine.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD
pip install -r requirements.txt
2. For example, use this command to run the performance benchmark test on the {{ model.model }} model
using one node with the {{ model.precision }} data type on the host machine.
.. code-block:: shell
export MAD_SECRETS_HFTOKEN="your personal Hugging Face token to access gated models"
madengine run \
--tags {{ model.mad_tag }} \
--keep-model-dir \
--live-output \
--timeout 28800
MAD launches a Docker container with the name
``container_ci-{{ model.mad_tag }}``. The latency and throughput reports of the
model are collected in ``~/MAD/perf.csv``.
{% endfor %}
{% endfor %}
.. tab-item:: Standalone benchmarking
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{ model.mad_tag }}
The following run commands are tailored to {{ model.model }}.
See :ref:`amd-primus-pytorch-model-support-v258` to switch to another available model.
.. rubric:: Download the Docker image and required packages
1. Use the following command to pull the Docker image from Docker Hub.
.. code-block:: shell
docker pull {{ unified_docker.pull_tag }}
2. Run the Docker container.
.. code-block:: shell
docker run -it \
--device /dev/dri \
--device /dev/kfd \
--network host \
--ipc host \
--group-add video \
--cap-add SYS_PTRACE \
--security-opt seccomp=unconfined \
--privileged \
-v $HOME:$HOME \
-v $HOME/.ssh:/root/.ssh \
--shm-size 64G \
--name training_env \
{{ unified_docker.pull_tag }}
Use these commands if you exit the ``training_env`` container and need to return to it.
.. code-block:: shell
docker start training_env
docker exec -it training_env bash
3. In the Docker container, clone the `<https://github.com/ROCm/MAD>`__
repository and navigate to the benchmark scripts directory
``/workspace/MAD/scripts/pytorch_train``.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD/scripts/pytorch_train
.. rubric:: Prepare training datasets and dependencies
1. The following benchmarking examples require downloading models and datasets
from Hugging Face. To ensure successful access to gated repos, set your
``HF_TOKEN``.
.. code-block:: shell
export HF_TOKEN=$your_personal_hugging_face_access_token
2. Run the setup script to install libraries and datasets needed for benchmarking.
.. code-block:: shell
./pytorch_benchmark_setup.sh
.. rubric:: Pretraining
To start the pretraining benchmark, use the following command with the
appropriate options. See the following list of options and their descriptions.
.. code-block:: shell
./pytorch_benchmark_report.sh -t pretrain \
-m {{ model.model_repo }} \
-p $datatype \
-s $sequence_length
.. list-table::
:header-rows: 1
* - Name
- Options
- Description
{% for mode in available_modes %}
* - {% if loop.first %}``$training_mode``{% endif %}
- ``{{ mode }}``
- {{ training_mode_descs[mode] }}
{% endfor %}
* - ``$datatype``
- ``BF16``{% if model.mad_tag == "primus_pyt_train_llama-3.1-8b" %} or ``FP8``{% endif %}
- Currently, only Llama 3.1 8B supports FP8 precision.
* - ``$sequence_length``
- Sequence length for the language model.
- Between 2048 and 8192. 8192 by default.
.. rubric:: Benchmarking examples
Use the following command to run train {{ model.model }} with BF16 precision using Primus torchtitan.
.. code-block:: shell
./pytorch_benchmark_report.sh -m {{ model.model_repo }}
To train {{ model.model }} with FP8 precision, use the following command.
.. code-block:: shell
./pytorch_benchmark_report.sh -m {{ model.model_repo }} -p FP8
{% endfor %}
{% endfor %}
Further reading
===============
- For an introduction to Primus, see `Primus: A Lightweight, Unified Training
Framework for Large Models on AMD GPUs <https://rocm.blogs.amd.com/software-tools-optimization/primus/README.html>`__.
- To learn more about MAD and the ``madengine`` CLI, see the `MAD usage guide <https://github.com/ROCm/MAD?tab=readme-ov-file#usage-guide>`__.
- To learn more about system settings and management practices to configure your system for
AMD Instinct MI300X series GPUs, see `AMD Instinct MI300X system optimization <https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300x.html>`_.
- For a list of other ready-made Docker images for AI with ROCm, see
`AMD Infinity Hub <https://www.amd.com/en/developer/resources/infinity-hub.html#f-amd_hub_category=AI%20%26%20ML%20Models>`_.
Previous versions
=================
See :doc:`pytorch-training-history` to find documentation for previous releases
of the ``ROCm/pytorch-training`` Docker image.

View File

@@ -0,0 +1,588 @@
:orphan:
.. meta::
:description: How to train a model using PyTorch for ROCm.
:keywords: ROCm, AI, LLM, train, PyTorch, torch, Llama, flux, tutorial, docker
**************************************
Training a model with PyTorch on ROCm
**************************************
.. caution::
This documentation does not reflect the latest version of ROCm PyTorch training
performance benchmark documentation. See :doc:`../pytorch-training` for the latest version.
PyTorch is an open-source machine learning framework that is widely used for
model training with GPU-optimized components for transformer-based models.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/pytorch-training-v25.8-benchmark-models.yaml
{% set dockers = data.dockers %}
{% set docker = dockers[0] %}
The `PyTorch for ROCm training Docker <{{ docker.docker_hub_url }}>`__
(``{{ docker.pull_tag }}``) image provides a prebuilt optimized environment for fine-tuning and pretraining a
model on AMD Instinct MI325X and MI300X GPUs. It includes the following software components to accelerate
training workloads:
.. list-table::
:header-rows: 1
* - Software component
- Version
{% for component_name, component_version in docker.components.items() %}
* - {{ component_name }}
- {{ component_version }}
{% endfor %}
.. _amd-pytorch-training-model-support:
Supported models
================
The following models are pre-optimized for performance on the AMD Instinct MI325X and MI300X GPUs.
Some instructions, commands, and training recommendations in this documentation might
vary by model -- select one to get started.
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/pytorch-training-v25.8-benchmark-models.yaml
{% set unified_docker = data.dockers[0] %}
{% set model_groups = data.model_groups %}
.. raw:: html
<div id="vllm-benchmark-ud-params-picker" class="container-fluid">
<div class="row gx-0">
<div class="col-2 me-1 px-2 model-param-head">Model</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
<div class="col-4 px-2 model-param" data-param-k="model-group" data-param-v="{{ model_group.tag }}" tabindex="0">{{ model_group.group }}</div>
{% endfor %}
</div>
</div>
<div class="row gx-0 pt-1">
<div class="col-2 me-1 px-2 model-param-head">Variant</div>
<div class="row col-10 pe-0">
{% for model_group in model_groups %}
{% set models = model_group.models %}
{% for model in models %}
{% if models|length % 3 == 0 %}
<div class="col-4 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% else %}
<div class="col-6 px-2 model-param" data-param-k="model" data-param-v="{{ model.mad_tag }}" data-param-group="{{ model_group.tag }}" tabindex="0">{{ model.model }}</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
</div>
</div>
.. _amd-pytorch-training-supported-training-modes:
The following table lists supported training modes per model.
.. dropdown:: Supported training modes
.. list-table::
:header-rows: 1
* - Model
- Supported training modes
{% for model_group in model_groups %}
{% set models = model_group.models %}
{% for model in models %}
{% if model.training_modes %}
* - {{ model.model }}
- ``{{ model.training_modes | join('``, ``') }}``
{% endif %}
{% endfor %}
{% endfor %}
.. note::
Some model and fine-tuning combinations are not listed. This is
because the `upstream torchtune repository <https://github.com/pytorch/torchtune>`__
doesn't provide default YAML configurations for them.
For advanced usage, you can create a custom configuration to enable
unlisted fine-tuning methods by using an existing file in the
``/workspace/torchtune/recipes/configs`` directory as a template.
.. _amd-pytorch-training-performance-measurements:
Performance measurements
========================
To evaluate performance, the
`Performance results with AMD ROCm software <https://www.amd.com/en/developer/resources/rocm-hub/dev-ai/performance-results.html#tabs-a8deaeb413-item-21cea50186-tab>`_
page provides reference throughput and latency measurements for training
popular AI models.
.. note::
The performance data presented in
`Performance results with AMD ROCm software <https://www.amd.com/en/developer/resources/rocm-hub/dev-ai/performance-results.html#tabs-a8deaeb413-item-21cea50186-tab>`_
should not be interpreted as the peak performance achievable by AMD
Instinct MI325X and MI300X GPUs or ROCm software.
System validation
=================
Before running AI workloads, it's important to validate that your AMD hardware is configured
correctly and performing optimally.
If you have already validated your system settings, including aspects like NUMA auto-balancing, you
can skip this step. Otherwise, complete the procedures in the :ref:`System validation and
optimization <rocm-for-ai-system-optimization>` guide to properly configure your system settings
before starting training.
To test for optimal performance, consult the recommended :ref:`System health benchmarks
<rocm-for-ai-system-health-bench>`. This suite of tests will help you verify and fine-tune your
system's configuration.
This Docker image is optimized for specific model configurations outlined
below. Performance can vary for other training workloads, as AMD
doesnt test configurations and run conditions outside those described.
Run training
============
.. datatemplate:yaml:: /data/how-to/rocm-for-ai/training/previous-versions/pytorch-training-v25.8-benchmark-models.yaml
{% set unified_docker = data.dockers[0] %}
{% set model_groups = data.model_groups %}
Once the setup is complete, choose between two options to start benchmarking training:
.. tab-set::
.. tab-item:: MAD-integrated benchmarking
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{ model.mad_tag }}
The following run command is tailored to {{ model.model }}.
See :ref:`amd-pytorch-training-model-support` to switch to another available model.
1. Clone the ROCm Model Automation and Dashboarding (`<https://github.com/ROCm/MAD>`__) repository to a local
directory and install the required packages on the host machine.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD
pip install -r requirements.txt
2. For example, use this command to run the performance benchmark test on the {{ model.model }} model
using one node with the {{ model.precision }} data type on the host machine.
.. code-block:: shell
export MAD_SECRETS_HFTOKEN="your personal Hugging Face token to access gated models"
madengine run \
--tags {{ model.mad_tag }} \
--keep-model-dir \
--live-output \
--timeout 28800
MAD launches a Docker container with the name
``container_ci-{{ model.mad_tag }}``. The latency and throughput reports of the
model are collected in ``~/MAD/perf.csv``.
{% endfor %}
{% endfor %}
.. tab-item:: Standalone benchmarking
{% for model_group in model_groups %}
{% for model in model_group.models %}
.. container:: model-doc {{ model.mad_tag }}
The following commands are tailored to {{ model.model }}.
See :ref:`amd-pytorch-training-model-support` to switch to another available model.
{% endfor %}
{% endfor %}
.. rubric:: Download the Docker image and required packages
1. Use the following command to pull the Docker image from Docker Hub.
.. code-block:: shell
docker pull {{ unified_docker.pull_tag }}
2. Run the Docker container.
.. code-block:: shell
docker run -it \
--device /dev/dri \
--device /dev/kfd \
--network host \
--ipc host \
--group-add video \
--cap-add SYS_PTRACE \
--security-opt seccomp=unconfined \
--privileged \
-v $HOME:$HOME \
-v $HOME/.ssh:/root/.ssh \
--shm-size 64G \
--name training_env \
{{ unified_docker.pull_tag }}
Use these commands if you exit the ``training_env`` container and need to return to it.
.. code-block:: shell
docker start training_env
docker exec -it training_env bash
3. In the Docker container, clone the `<https://github.com/ROCm/MAD>`__
repository and navigate to the benchmark scripts directory
``/workspace/MAD/scripts/pytorch_train``.
.. code-block:: shell
git clone https://github.com/ROCm/MAD
cd MAD/scripts/pytorch_train
.. rubric:: Prepare training datasets and dependencies
1. The following benchmarking examples require downloading models and datasets
from Hugging Face. To ensure successful access to gated repos, set your
``HF_TOKEN``.
.. code-block:: shell
export HF_TOKEN=$your_personal_hugging_face_access_token
2. Run the setup script to install libraries and datasets needed for benchmarking.
.. code-block:: shell
./pytorch_benchmark_setup.sh
.. container:: model-doc pyt_train_llama-3.1-8b
``pytorch_benchmark_setup.sh`` installs the following libraries for Llama 3.1 8B:
.. list-table::
:header-rows: 1
* - Library
- Reference
* - ``accelerate``
- `Hugging Face Accelerate <https://huggingface.co/docs/accelerate/en/index>`_
* - ``datasets``
- `Hugging Face Datasets <https://huggingface.co/docs/datasets/v3.2.0/en/index>`_ 3.2.0
.. container:: model-doc pyt_train_llama-3.1-70b
``pytorch_benchmark_setup.sh`` installs the following libraries for Llama 3.1 70B:
.. list-table::
:header-rows: 1
* - Library
- Reference
* - ``datasets``
- `Hugging Face Datasets <https://huggingface.co/docs/datasets/v3.2.0/en/index>`_ 3.2.0
* - ``torchdata``
- `TorchData <https://meta-pytorch.org/data/beta/index.html#torchdata>`__
* - ``tomli``
- `Tomli <https://pypi.org/project/tomli/>`__
* - ``tiktoken``
- `tiktoken <https://github.com/openai/tiktoken>`__
* - ``blobfile``
- `blobfile <https://pypi.org/project/blobfile/>`__
* - ``tabulate``
- `tabulate <https://pypi.org/project/tabulate/>`__
* - ``wandb``
- `Weights & Biases <https://github.com/wandb/wandb>`__
* - ``sentencepiece``
- `SentencePiece <https://github.com/google/sentencepiece>`__ 0.2.0
* - ``tensorboard``
- `TensorBoard <https://www.tensorflow.org/tensorboard>`__ 2.18.0
.. container:: model-doc pyt_train_flux
``pytorch_benchmark_setup.sh`` installs the following libraries for FLUX:
.. list-table::
:header-rows: 1
* - Library
- Reference
* - ``accelerate``
- `Hugging Face Accelerate <https://huggingface.co/docs/accelerate/en/index>`_
* - ``datasets``
- `Hugging Face Datasets <https://huggingface.co/docs/datasets/v3.2.0/en/index>`__ 3.2.0
* - ``sentencepiece``
- `SentencePiece <https://github.com/google/sentencepiece>`__ 0.2.0
* - ``tensorboard``
- `TensorBoard <https://www.tensorflow.org/tensorboard>`__ 2.18.0
* - ``csvkit``
- `csvkit <https://csvkit.readthedocs.io/en/latest/>`__ 2.0.1
* - ``deepspeed``
- `DeepSpeed <https://github.com/deepspeedai/DeepSpeed>`__ 0.16.2
* - ``diffusers``
- `Hugging Face Diffusers <https://huggingface.co/docs/diffusers/en/index>`__ 0.31.0
* - ``GitPython``
- `GitPython <https://github.com/gitpython-developers/GitPython>`__ 3.1.44
* - ``opencv-python-headless``
- `opencv-python-headless <https://pypi.org/project/opencv-python-headless/>`__ 4.10.0.84
* - ``peft``
- `PEFT <https://huggingface.co/docs/peft/en/index>`__ 0.14.0
* - ``protobuf``
- `Protocol Buffers <https://github.com/protocolbuffers/protobuf>`__ 5.29.2
* - ``pytest``
- `PyTest <https://docs.pytest.org/en/stable/>`__ 8.3.4
* - ``python-dotenv``
- `python-dotenv <https://pypi.org/project/python-dotenv/>`__ 1.0.1
* - ``seaborn``
- `Seaborn <https://seaborn.pydata.org/>`__ 0.13.2
* - ``transformers``
- `Transformers <https://huggingface.co/docs/transformers/en/index>`__ 4.47.0
``pytorch_benchmark_setup.sh`` downloads the following datasets from Hugging Face:
* `bghira/pseudo-camera-10k <https://huggingface.co/datasets/bghira/pseudo-camera-10k>`__
{% for model_group in model_groups %}
{% for model in model_group.models %}
{% set training_modes = model.training_modes %}
{% set training_mode_descs = {
"pretrain": "Benchmark pre-training.",
"HF_pretrain": "Llama 3.1 8B pre-training with FP8 precision."
} %}
{% set available_modes = training_modes | select("in", ["pretrain", "HF_pretrain"]) | list %}
{% if available_modes %}
.. container:: model-doc {{ model.mad_tag }}
.. rubric:: Pre-training
To start the pre-training benchmark, use the following command with the
appropriate options. See the following list of options and their descriptions.
.. code-block:: shell
./pytorch_benchmark_report.sh -t {% if available_modes | length == 1 %}{{ available_modes[0] }}{% else %}$training_mode{% endif %} \
-m {{ model.model_repo }} \
-p $datatype \
-s $sequence_length
{% if model.mad_tag == "pyt_train_flux" %}
.. container:: model-doc {{ model.mad_tag }}
.. note::
Currently, FLUX models are not supported out-of-the-box on {{ unified_docker.pull_tag }}.
To use FLUX, refer to ``rocm/pytorch-training`` Docker: :doc:`pytorch-training-v25.6`
Occasionally, downloading the Flux dataset might fail. In the event of this
error, manually download it from Hugging Face at
`black-forest-labs/FLUX.1-dev <https://huggingface.co/black-forest-labs/FLUX.1-dev>`_
and save it to `/workspace/FluxBenchmark`. This ensures that the test script can access
the required dataset.
{% endif %}
.. list-table::
:header-rows: 1
* - Name
- Options
- Description
{% for mode in available_modes %}
* - {% if loop.first %}``$training_mode``{% endif %}
- ``{{ mode }}``
- {{ training_mode_descs[mode] }}
{% endfor %}
* - ``$datatype``
- ``BF16``{% if model.mad_tag == "pyt_train_llama-3.1-8b" %} or ``FP8``{% endif %}
- Only Llama 3.1 8B supports FP8 precision.
* - ``$sequence_length``
- Sequence length for the language model.
- Between 2048 and 8192. 8192 by default.
{% endif %}
{% set training_mode_descs = {
"finetune_fw": "Full weight fine-tuning (BF16 and FP8 supported).",
"finetune_lora": "LoRA fine-tuning (BF16 supported).",
"finetune_qlora": "QLoRA fine-tuning (BF16 supported).",
"HF_finetune_lora": "LoRA fine-tuning with Hugging Face PEFT.",
} %}
{% set available_modes = training_modes | select("in", ["finetune_fw", "finetune_lora", "finetune_qlora", "HF_finetune_lora"]) | list %}
{% if available_modes %}
.. container:: model-doc {{ model.mad_tag }}
.. rubric:: Fine-tuning
To start the fine-tuning benchmark, use the following command with the
appropriate options. See the following list of options and their descriptions.
See :ref:`supported training modes <amd-pytorch-training-supported-training-modes>`.
.. code-block:: shell
./pytorch_benchmark_report.sh -t $training_mode \
-m {{ model.model_repo }} \
-p $datatype \
-s $sequence_length
.. list-table::
:header-rows: 1
* - Name
- Options
- Description
{% for mode in available_modes %}
* - {% if loop.first %}``$training_mode``{% endif %}
- ``{{ mode }}``
- {{ training_mode_descs[mode] }}
{% endfor %}
* - ``$datatype``
- ``BF16``{% if "finetune_fw" in available_modes %} or ``FP8``{% endif %}
- All models support BF16.{% if "finetune_fw" in available_modes %} FP8 is only available for full weight fine-tuning.{% endif %}
* - ``$sequence_length``
- Between 2048 and 16384.
- Sequence length for the language model.
{% if model.mad_tag in ["pyt_train_llama3.2-vision-11b", "pyt_train_llama-3.2-vision-90b"] %}
.. note::
For LoRA and QLoRA support with vision models (Llama 3.2 11B and 90B),
use the following torchtune commit for compatibility:
.. code-block:: shell
git checkout 48192e23188b1fc524dd6d127725ceb2348e7f0e
{% elif model.mad_tag in ["pyt_train_llama-2-7b", "pyt_train_llama-2-13b", "pyt_train_llama-2-70b"] %}
.. note::
You might encounter the following error with Llama 2: ``ValueError: seq_len (16384) of
input tensor should be smaller than max_seq_len (4096)``.
This error indicates that an input sequence is longer than the model's maximum context window.
Ensure your tokenized input does not exceed the model's ``max_seq_len`` (4096
tokens in this case). You can resolve this by truncating the input or splitting
it into smaller chunks before passing it to the model.
Note on reproducibility: The results in this guide are based on
commit ``b4c98ac`` from the upstream
`<https://github.com/pytorch/torchtune>`__ repository. For the
latest updates, you can use the main branch.
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
.. rubric:: Benchmarking examples
For examples of benchmarking commands, see `<https://github.com/ROCm/MAD/tree/develop/benchmark/pytorch_train#benchmarking-examples>`__.
.. _amd-pytorch-training-multinode-examples:
Multi-node training
-------------------
Refer to :doc:`/how-to/rocm-for-ai/system-setup/multi-node-setup` to configure your environment for multi-node
training. See :ref:`rocm-for-ai-multi-node-setup-pyt-train-example` for example Slurm run commands.
Pre-training
~~~~~~~~~~~~
Multi-node training with torchtitan is supported. The provided SLURM script is pre-configured for Llama 3 70B.
To launch the training job on a SLURM cluster for Llama 3 70B, run the following commands from the MAD repository.
.. code-block:: shell
# In the MAD repository
cd scripts/pytorch_train
sbatch run_slurm_train.sh
Fine-tuning
~~~~~~~~~~~
Multi-node training with torchtune is supported. The provided SLURM script is pre-configured for Llama 3.3 70B.
To launch the training job on a SLURM cluster for Llama 3.3 70B, run the following commands from the MAD repository.
.. code-block:: shell
huggingface-cli login # Get access to HF Llama model space
huggingface-cli download meta-llama/Llama-3.3-70B-Instruct --local-dir ./models/Llama-3.3-70B-Instruct # Download the Llama 3.3 model locally
# In the MAD repository
cd scripts/pytorch_train
sbatch Torchtune_Multinode.sh
.. note::
Information regarding benchmark setup:
* By default, Llama 3.3 70B is fine-tuned using ``alpaca_dataset``.
* You can adjust the torchtune `YAML configuration file
<https://github.com/pytorch/torchtune/blob/main/recipes/configs/llama3_3/70B_full_multinode.yaml>`__
if you're using a different model.
* The number of nodes and other parameters can be tuned in the SLURM script ``Torchtune_Multinode.sh``.
* Set the ``mounting_paths`` inside the SLURM script.
Once the run is finished, you can find the log files in the ``result_torchtune/`` directory.
Further reading
===============
- To learn more about MAD and the ``madengine`` CLI, see the `MAD usage guide <https://github.com/ROCm/MAD?tab=readme-ov-file#usage-guide>`__.
- To learn more about system settings and management practices to configure your system for
AMD Instinct MI300X series GPUs, see `AMD Instinct MI300X system optimization <https://instinct.docs.amd.com/projects/amdgpu-docs/en/latest/system-optimization/mi300x.html>`_.
- For a list of other ready-made Docker images for AI with ROCm, see
`AMD Infinity Hub <https://www.amd.com/en/developer/resources/infinity-hub.html#f-amd_hub_category=AI%20%26%20ML%20Models>`_.
Previous versions
=================
See :doc:`pytorch-training-history` to find documentation for previous releases
of the ``ROCm/pytorch-training`` Docker image.

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,6 @@
```
```{eval-rst}
.. dropdown:: Example output of ``rocminfo``
.. code-block:: shell-session
@@ -38,7 +37,7 @@
XNACK enabled: NO
DMAbuf Support: YES
VMM Support: YES
==========
HSA Agents
==========
@@ -52,4 +51,3 @@
[output truncated]
```

View File

@@ -5,7 +5,6 @@ hipinfo
```
```{eval-rst}
.. dropdown:: Example output of ``hipinfo``
.. code-block:: shell-session
@@ -20,4 +19,3 @@ hipinfo
[output truncated]
```

View File

@@ -5,7 +5,6 @@
```
```{eval-rst}
.. dropdown:: Example output of ``hipinfo``
.. code-block:: shell-session
@@ -21,7 +20,6 @@
[output truncated]
```
2. Inspect your ROCm installation in your Python environment.
```bash

View File

@@ -1,13 +1,13 @@
1. Delete the `C:\TheRock\build` and its contents.
2. Delete the environment variables. For example, using Powershell as an administrator:
2. Delete the environment variables. For example, using PowerShell as an administrator:
```powershell
[Environment]::SetEnvironmentVariable("HIP_PATH", $null, "Machine")
[Environment]::SetEnvironmentVariable("HIP_DEVICE_LIB_PATH", $null, "Machine")
[Environment]::SetEnvironmentVariable("HIP_PLATFORM", $null, "Machine")
[Environment]::SetEnvironmentVariable("LLVM_PATH", $null, "Machine")
```
```powershell
[Environment]::SetEnvironmentVariable("HIP_PATH", $null, "Machine")
[Environment]::SetEnvironmentVariable("HIP_DEVICE_LIB_PATH", $null, "Machine")
[Environment]::SetEnvironmentVariable("HIP_PLATFORM", $null, "Machine")
[Environment]::SetEnvironmentVariable("LLVM_PATH", $null, "Machine")
```
3. Remove the following paths from your PATH environment variable using your system settings GUI.

View File

@@ -46,4 +46,4 @@ ROCm SMI for ROCm 6.1.2
#### Fixes
* Fixed an issue causing ROCm SMI to incorrectly report GPU utilization for RDNA3 GPUs. See the issue on [GitHub](https://github.com/ROCm/ROCm/issues/3112).
* Fixed the parsing of `pp_od_clk_voltage` in `get_od_clk_volt_info` to work better with MI-series hardware.
* Fixed the parsing of `pp_od_clk_voltage` in `get_od_clk_volt_info` to work better with MI-Series hardware.

View File

@@ -33,10 +33,10 @@ Until a fix is provided, users should rely on ROCm v5.2.3 to support their SRIOV
#### AMD Instinct™ MI200 firmware updates
Customers cannot update the Integrated Firmware Image (IFWI) for AMD Instinct™ MI200 accelerators.
Customers cannot update the Integrated Firmware Image (IFWI) for AMD Instinct™ MI200 GPUs.
An updated firmware maintenance bundle consisting of an installation tool and images specific to
AMD Instinct™ MI200 accelerators is under planning and will be available soon.
AMD Instinct™ MI200 GPUs is under planning and will be available soon.
#### Known issue with rocThrust and rocPRIM libraries

View File

@@ -50,12 +50,12 @@ fixed in this release.
#### AMD Instinct™ MI200 firmware IFWI maintenance update #3
This IFWI release fixes the following issue in AMD Instinct™ MI210/MI250 Accelerators.
This IFWI release fixes the following issue in AMD Instinct™ MI210/MI250 GPUs.
After prolonged periods of operation, certain MI200 Instinct™ Accelerators may perform in a degraded
After prolonged periods of operation, certain MI200 Instinct™ GPUs may perform in a degraded
way resulting in application failures.
In this package, AMD delivers a new firmware version for MI200 GPU accelerators and a firmware
In this package, AMD delivers a new firmware version for MI200 GPU GPUs and a firmware
installation tool AMD FW FLASH 1.2.
| GPU | Productionp part number | SKU | IFWI name |

View File

@@ -10,10 +10,10 @@ New features include:
* AddressSanitizer for host and device code (GPU) is now available as a beta
Note that ROCm 5.7.0 is EOS for MI50. 5.7 versions of ROCm are the last major releases in the ROCm 5
series. This release is Linux-only.
Series. This release is Linux-only.
:::{important}
The next major ROCm release (ROCm 6.0) will not be backward compatible with the ROCm 5 series.
The next major ROCm release (ROCm 6.0) will not be backward compatible with the ROCm 5 Series.
Changes will include: splitting LLVM packages into more manageable sizes, changes to the HIP runtime
API, splitting rocRAND and hipRAND into separate packages, and reorganizing our file structure.
:::

View File

@@ -3,7 +3,7 @@
ROCm 6.0 is a major release with new performance optimizations, expanded frameworks and library
support, and improved developer experience. This includes initial enablement of the AMD Instinct™
MI300 series.Future releases will further enable and optimize this new platform. Key features include:
MI300 Series.Future releases will further enable and optimize this new platform. Key features include:
* Improved performance in areas like lower precision math and attention layers.
* New hipSPARSELt library to accelerate AI workloads via AMD's sparse matrix core technique.
@@ -18,7 +18,7 @@ the [Changelog](https://rocm.docs.amd.com/en/docs-6.0.0/about/CHANGELOG.html).
### OS and GPU support changes
AMD Instinct™ MI300A and MI300X Accelerator support has been enabled for limited operating
AMD Instinct™ MI300A and MI300X GPU support has been enabled for limited operating
systems.
* Ubuntu 22.04.3 (MI300A and MI300X)

View File

@@ -3,7 +3,7 @@ ROCm™ 6.1.1 introduces minor fixes and improvements to some tools and librarie
### OS support
* ROCm 6.1.1 now supports Oracle Linux. It has been tested against version 8.9 (kernel 5.15.0-205) with AMD Instinct MI300X accelerators.
* ROCm 6.1.1 now supports Oracle Linux. It has been tested against version 8.9 (kernel 5.15.0-205) with AMD Instinct MI300X GPUs.
* ROCm 6.1.1 has been tested against a pre-release version of Ubuntu 22.04.5 (kernel: 5.15 [GA], 6.8 [HWE]).

View File

@@ -28,7 +28,7 @@ This section introduces notable new features and improvements in ROCm 6.2. See t
ROCm 6.2.0 introduces the following new components to the ROCm software stack.
- **Omniperf** -- A kernel-level profiling tool for machine learning and high-performance computing (HPC) workloads
running on AMD Instinct accelerators. Omniperf offers comprehensive profiling and advanced analysis via command line
running on AMD Instinct GPUs. Omniperf offers comprehensive profiling and advanced analysis via command line
or a GUI dashboard. For more information, see
[Omniperf](https://rocm.docs.amd.com/projects/omniperf/en/latest).
@@ -141,7 +141,7 @@ For more information, see [Model quantization techniques](https://rocm.docs.amd.
#### Improved vLLM support
ROCm 6.2.0 enhances vLLM support for inference on AMD Instinct accelerators, adding
ROCm 6.2.0 enhances vLLM support for inference on AMD Instinct GPUs, adding
capabilities for `FP16`/`BF16` precision for LLMs, and `FP8` support for Llama.
ROCm 6.2.0 adds support for the following vLLM features:
@@ -177,12 +177,12 @@ To enable these experimental new features, see
Use the `rocm/vllm` branch when cloning the GitHub repo. The `vllm/ROCm_performance.md` document outlines
all the accessible features, and the `vllm/Dockerfile.rocm` file can be used.
### Enhanced performance tuning on AMD Instinct accelerators
### Enhanced performance tuning on AMD Instinct GPUs
ROCm is pre-tuned for high-performance computing workloads including large language models, generative AI, and scientific computing.
The ROCm documentation provides comprehensive guidance on configuring your system for AMD Instinct accelerators. It includes
The ROCm documentation provides comprehensive guidance on configuring your system for AMD Instinct GPUs. It includes
detailed instructions on system settings and application tuning suggestions to help you fully leverage the capabilities of these
accelerators for optimal performance. For more information, see
GPUs for optimal performance. For more information, see
[AMD MI300X tuning guides](https://rocm.docs.amd.com/en/docs-6.2.0/how-to/tuning-guides/mi300x/index.html) and
[AMD MI300A system optimization](https://rocm.docs.amd.com/en/docs-6.2.0/how-to/system-optimization/mi300x.html).

View File

@@ -22,7 +22,7 @@ The following is a significant fix introduced in ROCm 6.2.2.
### Fixed Instinct MI300X error recovery failure
Improved the reliability of AMD Instinct MI300X accelerators in scenarios involving
Improved the reliability of AMD Instinct MI300X GPUs in scenarios involving
uncorrectable errors. Previously, error recovery did not occur as expected,
potentially leaving the system in an undefined state. This fix ensures that error
recovery functions as expected, maintaining system stability.

View File

@@ -32,7 +32,7 @@ ROCm documentation continues to be updated to provide clearer and more comprehen
a wider variety of user needs and use cases.
* Added a new GPU cluster networking guide. See
[Cluster network performance validation for AMD Instinct accelerators](https://rocm.docs.amd.com/projects/gpu-cluster-networking/en/latest/index.html).
[Cluster network performance validation for AMD Instinct GPUs](https://rocm.docs.amd.com/projects/gpu-cluster-networking/en/latest/index.html).
This documentation provides guidelines on validating network configurations
in single-node and multi-node environments to attain optimal speed and bandwidth

View File

@@ -138,7 +138,7 @@ wider variety of user needs and use cases.
documentation](https://rocm.docs.amd.com/projects/Tensile/en/docs-6.3.0/src/index.html).
- New documentation has been added to explain the advantages of enabling the IOMMU in passthrough
mode for Instinct accelerators and Radeon GPUs. See [Input-Output Memory Management
mode for Instinct GPUs and Radeon GPUs. See [Input-Output Memory Management
Unit](https://rocm.docs.amd.com/en/docs-6.3.0/conceptual/iommu.html).
- The HIP documentation has been updated and includes the following new topics:

View File

@@ -26,9 +26,9 @@ documentation to verify compatibility and system requirements.
The following are notable new features and improvements in ROCm 6.3.1. For changes to individual components, see
[Detailed component changes](#detailed-component-changes).
### Per queue resiliency for Instinct MI300 accelerators
### Per queue resiliency for Instinct MI300 GPUs
The AMDGPU driver now includes enhanced resiliency for misbehaving applications on AMD Instinct MI300 accelerators. This helps isolate the impact of misbehaving applications, ensuring other workloads running on the same accelerator are unaffected.
The AMDGPU driver now includes enhanced resiliency for misbehaving applications on AMD Instinct MI300 GPUs. This helps isolate the impact of misbehaving applications, ensuring other workloads running on the same GPU are unaffected.
### ROCm Runfile Installer
@@ -38,7 +38,7 @@ ROCm 6.3.1 introduces the ROCm Runfile Installer, with initial support for Ubunt
ROCm documentation continues to be updated to provide clearer and more comprehensive guidance for a wider variety of user needs and use cases.
* Added documentation on training a model with ROCm Megatron-LM. AMD offers a Docker image for MI300X accelerators
* Added documentation on training a model with ROCm Megatron-LM. AMD offers a Docker image for MI300X GPUs
containing essential components to get started, including ROCm libraries, PyTorch, and Megatron-LM utilities. See
[Training a model using ROCm Megatron-LM](https://rocm.docs.amd.com/en/latest/how-to/rocm-for-ai/train-a-model.html)
to get started.

View File

@@ -45,9 +45,9 @@ bash -c "echo taskset -p \$\$"
See [issue #3493](https://github.com/ROCm/ROCm/issues/3493) on GitHub.
### Display issues on servers with Instinct MI300-series accelerators when loading AMDGPU driver
### Display issues on servers with Instinct MI300-Series GPUs when loading AMDGPU driver
AMD Instinct MI300-series accelerators and third-party GPUs such as the Matrox G200 have an issue impacting video
AMD Instinct MI300-Series GPUs and third-party GPUs such as the Matrox G200 have an issue impacting video
output. The issue was reproduced on a Dell server model PowerEdge XE9680. Servers from other vendors utilizing Matrox
G200 cards may be impacted as well. This issue was found with ROCm 6.2.0 but is present in older ROCm versions.

View File

@@ -5,7 +5,7 @@ individual components are listed in the [Detailed component changes](detailed-co
### Instinct MI300X GPU recovery failure on uncorrectable errors
For the AMD Instinct MI300X accelerator, GPU recovery resets triggered by uncorrectable errors (UE) might not complete
For the AMD Instinct MI300X GPU, GPU recovery resets triggered by uncorrectable errors (UE) might not complete
successfully, which can result in the system being left in an undefined state. A system reboot is needed to recover from
this state. Additionally, error logging might fail in these situations, hindering diagnostics.

View File

@@ -5,13 +5,13 @@ issues related to individual components, review the [Detailed component changes]
### Instinct MI300X reports incorrect raw GPU timestamps
On MI300X accelerators, the command processor firmware reports incorrect raw GPU timestamps. This
On MI300X GPUs, the command processor firmware reports incorrect raw GPU timestamps. This
issue is under investigation and will be addressed in a future release. See [GitHub issue #4079](https://github.com/ROCm/ROCm/issues/4079).
### Instinct MI300 series: backward weights convolution performance issue
### Instinct MI300 Series: backward weights convolution performance issue
A performance issue affects certain tensor shapes during backward weights convolution when using
FP16 or FP32 data types on Instinct MI300 series accelerators. This issue will be addressed in a future ROCm release.
FP16 or FP32 data types on Instinct MI300 Series GPUs. This issue will be addressed in a future ROCm release.
See [GitHub issue #4080](https://github.com/ROCm/ROCm/issues/4080).
To mitigate the issue during model training, set the following environment variables:
@@ -77,7 +77,7 @@ This issue will be addressed in a future ROCm release. See [GitHub issue #4085](
Canny edge detection kernels might access out-of-bounds memory locations while
computing gradient intensities on edge pixels. This issue is isolated to
Canny-specific use cases on Instinct MI300 series accelerators. This issue is
Canny-specific use cases on Instinct MI300 Series GPUs. This issue is
resolved in the [MIVisionX `develop` branch](https://github.com/ROCm/mivisionx)
and will be part of a future ROCm release. See [GitHub issue #4086](https://github.com/ROCm/ROCm/issues/4086).

View File

@@ -3,9 +3,9 @@
The following are previously known issues resolved in this release. For resolved issues related to
individual components, review the [Detailed component changes](#detailed-component-changes).
### Instinct MI300 series: backward weights convolution performance issue
### Instinct MI300 Series: backward weights convolution performance issue
Fixed a performance issue affecting certain tensor shapes during backward weights convolution when using FP16 or FP32 data types on Instinct MI300 series accelerators. See [GitHub issue #4080](https://github.com/ROCm/ROCm/issues/4080).
Fixed a performance issue affecting certain tensor shapes during backward weights convolution when using FP16 or FP32 data types on Instinct MI300 Series GPUs. See [GitHub issue #4080](https://github.com/ROCm/ROCm/issues/4080).
### ROCm Compute Profiler and ROCm Systems Profiler post-upgrade issues

View File

@@ -19,7 +19,7 @@ This issue has been fixed in the ROCm 6.3.2 release. See [GitHub issue #4085](ht
An issue where Canny edge detection kernels accessed out-of-bounds memory locations while
computing gradient intensities on edge pixels has been fixed. This issue was isolated to
Canny-specific use cases on Instinct MI300 series accelerators. See [GitHub issue #4086](https://github.com/ROCm/ROCm/issues/4086).
Canny-specific use cases on Instinct MI300 Series GPUs. See [GitHub issue #4086](https://github.com/ROCm/ROCm/issues/4086).
### AMD VCN instability with rocDecode

View File

@@ -1,8 +1,8 @@
## Operating system and hardware support changes
ROCm 6.3.1 adds support for Debian 12 (kernel: 6.1). Debian is supported only on AMD Instinct accelerators. See the installation instructions at [Debian native installation](https://rocm.docs.amd.com/projects/install-on-linux/en/docs-6.3.1/install/native-install/debian.html).
ROCm 6.3.1 adds support for Debian 12 (kernel: 6.1). Debian is supported only on AMD Instinct GPUs. See the installation instructions at [Debian native installation](https://rocm.docs.amd.com/projects/install-on-linux/en/docs-6.3.1/install/native-install/debian.html).
ROCm 6.3.1 enables support for AMD Instinct MI325X accelerator. For more information, see [AMD Instinct™ MI325X Accelerators](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html).
ROCm 6.3.1 enables support for AMD Instinct MI325X GPU. For more information, see [AMD Instinct™ MI325X GPUs](https://www.amd.com/en/products/accelerators/instinct/mi300/mi325x.html).
See the [Compatibility
matrix](https://rocm.docs.amd.com/en/docs-6.3.1/compatibility/compatibility-matrix.html)

View File

@@ -1,6 +1,6 @@
## Operating system and hardware support changes
ROCm 6.3.2 adds support for Azure Linux 3.0 (kernel: 6.6). Azure Linux is supported only on AMD Instinct accelerators. For more information, see [Azure Linux installation](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/quick-start.html).
ROCm 6.3.2 adds support for Azure Linux 3.0 (kernel: 6.6). Azure Linux is supported only on AMD Instinct GPUs. For more information, see [Azure Linux installation](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/quick-start.html).
See the [Compatibility
matrix](https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html)

View File

@@ -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"

View File

@@ -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_<component>: output the dependencies for <component>
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:

View File

@@ -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 <pkg_type> Print path of output directory containing packages of type referred to by pkg_type"
echo " -p, --package <type> Specify packaging format"
echo " -h, --help Prints this help"
echo "Possible values for <type>:"
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

View File

@@ -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

View File

@@ -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 <type> Specify packaging format"
echo " -r, --release Make a release build instead of a debug build"
echo " -o, --outdir <pkg_type> 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 <type>:"
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"

View File

@@ -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 <pkg_type> 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

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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"

View File

@@ -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

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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"

View File

@@ -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 <pkg_type> 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"

View File

@@ -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

View File

@@ -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 <pkg_type> Print path of output directory containing packages of type referred to by pkg_type"
echo " -t, --offload-arch=<arch> Specify arch for catch tests ex: --offload-arch=gfx1030 --offload-arch=gfx1100"
echo " -p, --package <type> Specify packaging format"
echo
echo "Possible values for <type>:"
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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <pkg_type> 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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <pkg_type> 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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <pkg_type> 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"

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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"

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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"

View File

@@ -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 <type> 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 <type>:"
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"

View File

@@ -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 <type> 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 <type>:"
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"

View File

@@ -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 <pkg_type> 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 <type>:"
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"

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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 <openmp-extras.support@amd.com>"
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 <openmp-extras.support@amd.com>"
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 <openmp-extras.support@amd.com>"
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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <pkg_type> Print path of output directory containing packages of type referred to by pkg_type"
echo
echo "Possible values for <type>:"
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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <pkg_type> Print path of output directory containing packages of
type referred to by pkg_type"
echo " -p, --package <type> 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"

View File

@@ -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 <type> 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 <pkg_type> 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 <type>:"
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"

Some files were not shown because too many files have changed in this diff Show More