Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions third_party/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ RCCL_HOME ?= /opt/rocm/rccl
HPCX_HOME ?= /opt/hpcx
ROCM_PATH ?= /opt/rocm

OS_SKU ?= $(shell sort -r /etc/*-release | gawk 'match($$0, /^ID=(.*)$$/, a) { print toupper(a[1]); exit }')

CUDA_VER ?= $(shell nvcc --version | grep 'release' | awk '{print $$6}' | cut -c2- | cut -d '.' -f1-2)
ifeq ($(OS_SKU), AZURELINUX)
ROCBLAS_BRANCH ?= rocm-$(shell rpm -qa | grep 'rocm-dev-' | head -1 | awk -F'-' '{print $$3}' | cut -d '.' -f1-3)
HIPBLASLT_BRANCH ?= rocm-$(shell rpm -qa | grep 'rocm-dev-' | head -1 | awk -F'-' '{print $$3}' | cut -d '.' -f1-3)
else
ROCBLAS_BRANCH ?= rocm-$(shell dpkg -l | grep 'rocm-dev ' | awk '{print $$3}' | cut -d '.' -f1-3)
HIPBLASLT_BRANCH ?= rocm-$(shell dpkg -l | grep 'rocm-dev ' | awk '{print $$3}' | cut -d '.' -f1-3)
endif
ROCM_VER ?= $(shell hipconfig -R | grep -oP '\d+\.\d+\.\d+' || echo "0.0.0")

NUM_MAKE_JOBS ?= $(shell nproc --ignore=2)
Expand Down Expand Up @@ -195,7 +202,7 @@ ifneq (,$(wildcard hpl-tests/Makefile))
tar xzf hpl-2.3.tar.gz && \
cp Make.Linux_zen3 hpl-2.3 && \
cp Make.Linux_zen4 hpl-2.3 && \
make all
make OS_SKU=$(OS_SKU) all
cp -v ./hpl-tests/hpl-2.3/bin/Linux_zen3/xhpl $(SB_MICRO_PATH)/bin/xhpl_z3
cp -v ./hpl-tests/hpl-2.3/bin/Linux_zen4/xhpl $(SB_MICRO_PATH)/bin/xhpl_z4
cp -v ./hpl-tests/hpl_run.sh $(SB_MICRO_PATH)/bin/
Expand All @@ -208,7 +215,7 @@ cpu_stream: sb_micro_path
ifneq (,$(wildcard stream-tests/Makefile))
cd ./stream-tests && \
wget https://www.cs.virginia.edu/stream/FTP/Code/stream.c && \
make all
make OS_SKU=$(OS_SKU) all
cp -v ./stream-tests/stream* $(SB_MICRO_PATH)/bin/
endif

Expand All @@ -225,13 +232,13 @@ directx_amf_encoding_latency:
# Install requirements for Megatron-LM
megatron_lm:
cd Megatron && \
apt install -y python3-mpi4py && \
{ [ "$(OS_SKU)" = "AZURELINUX" ] || apt install -y python3-mpi4py; } && \
python -m pip install --no-cache-dir -r requirements.txt

# Install requirements for Megatron-DeepSpeed
megatron_deepspeed:
cd Megatron && \
apt install -y python3-mpi4py && \
{ [ "$(OS_SKU)" = "AZURELINUX" ] || apt install -y python3-mpi4py; } && \
python -m pip install --no-cache-dir -r requirements.txt && \
python -m pip install DeepSpeed

Expand Down
26 changes: 21 additions & 5 deletions third_party/hpl-tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

# OS_SKU is inherited from parent Makefile, but provide fallback if run independently
OS_SKU ?= $(shell sort -r /etc/*-release | gawk 'match($$0, /^ID=(.*)$$/, a) { print toupper(a[1]); exit }')

# Dynamically find AMD software paths
ifeq ($(OS_SKU), AZURELINUX)
BLIS_PATH := $(shell find /opt -path "*/amd-blis" 2>/dev/null | head -1)
BLIS_LIB := $(shell find /opt -name "libblis-mt.so" 2>/dev/null | head -1)
AOCC_PATH := $(shell find /opt -path "*/aocc-compiler*/bin/clang" 2>/dev/null | head -1)
endif

all: ZEN3 ZEN4 CONFIGURE

CONFIGURE:
cp ./hpl-2.3/setup/Make.Linux_ATHLON_CBLAS ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*ARCH .*=.*/ARCH =$$(arch)/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*TOPdir .*=.*/TOPdir = ..\/..\/../' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*ARCH .*=.*/ARCH =$$(arch)/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*TOPdir .*=.*/TOPdir = ..\/..\/../' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*MPdir .*=.*/MPdir = $$(omp)/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*MPinc .*=.*/MPinc = -I$$(MPdir)\/include/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*MPlib .*=.*/MPlib = $$(MPdir)\/lib\/libmpi.so/' ./hpl-2.3/Make.Linux_zen3
ifeq ($(OS_SKU), AZURELINUX)
sed -i 's|.*LAdir .*=.*|LAdir = $(BLIS_PATH)|' ./hpl-2.3/Make.Linux_zen3
sed -i 's|.*LAlib .*=.*|LAlib = $(BLIS_LIB)|' ./hpl-2.3/Make.Linux_zen3
sed -i 's|.*CC .*=.*|CC = $(AOCC_PATH)|' ./hpl-2.3/Make.Linux_zen3
sed -i 's|.*LINKER .*=.*|LINKER = $(AOCC_PATH)|' ./hpl-2.3/Make.Linux_zen3
else
sed -i 's/.*LAdir .*=.*/LAdir = \/opt\/AMD\/amd-blis/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/LAinc .*=/LAinc = -I$$(LAdir)\/lib\/include/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*LAlib .*=.*/LAlib = $$(LAdir)\/lib\/LP64\/libblis-mt.so/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*CC .*=.*/CC = \/opt\/AMD\/aocc-compiler-4.0.0\/bin\/clang/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*CC .*=.*/CC = \/opt\/AMD\/aocc-compiler-4.0.0\/bin\/clang/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*LINKER .*=.*/LINKER = \/opt\/AMD\/aocc-compiler-4.0.0\/bin\/clang/' ./hpl-2.3/Make.Linux_zen3
endif
sed -i 's/LAinc .*=/LAinc = -I$$(LAdir)\/lib\/include/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*CCFLAGS .*=.*/CCFLAGS = $$(HPL_DEFS) -march=znver3 -fomit-frame-pointer -O3 -funroll-loops/' ./hpl-2.3/Make.Linux_zen3
sed -i 's/.*LINKER .*=.*/LINKER = \/opt\/AMD\/aocc-compiler-4.0.0\/bin\/clang/' ./hpl-2.3/Make.Linux_zen3
cp ./hpl-2.3/Make.Linux_zen3 ./hpl-2.3/Make.Linux_zen4
sed -i 's/.*CCFLAGS .*=.*/CCFLAGS = $$(HPL_DEFS) -march=znver4 -fomit-frame-pointer -O3 -funroll-loops/' ./hpl-2.3/Make.Linux_zen4
ZEN3: CONFIGURE
Expand Down
15 changes: 13 additions & 2 deletions third_party/stream-tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

# OS_SKU is inherited from parent Makefile, but provide fallback if run independently
OS_SKU ?= $(shell sort -r /etc/*-release | gawk 'match($$0, /^ID=(.*)$$/, a) { print toupper(a[1]); exit }')

GENFLAGS := -DSTREAM_ARRAY_SIZE=120000000
ZEN3FLAGS := -DSTREAM_ARRAY_SIZE=400000000 -march=znver3
ZEN4FLAGS := -DSTREAM_ARRAY_SIZE=800000000 -march=znver4
Expand All @@ -23,8 +26,16 @@ ifeq ($(ARCH), aarch64)
endif

# AMD AOCC clang present? add ZEN3 and ZEN4
ifneq ("$(wildcard /opt/AMD/aocc-compiler-4.0.0/bin/clang)","")
CC := /opt/AMD/aocc-compiler-4.0.0/bin/clang
# Find AOCC compiler installation
ifeq ($(OS_SKU), AZURELINUX)
AOCC_CLANG := $(shell find /opt -path "*/aocc-compiler*/bin/clang" 2>/dev/null | head -1)
else
AOCC_CLANG := $(wildcard /opt/AMD/aocc-compiler-4.0.0/bin/clang)
endif

# Configure compiler if AOCC is found
ifneq ($(AOCC_CLANG),)
CC := $(AOCC_CLANG)
CFLAGS := -Ofast -mcmodel=large -mavx2 -ffp-contract=fast -lomp -fopenmp \
-fnt-store=aggressive -DNTIMES=10
ALL_TARGETS += ZEN3 ZEN4
Expand Down
Loading