Skip to content

Instantly share code, notes, and snippets.

View cgmb's full-sized avatar

Cory Bloor cgmb

  • Advanced Micro Devices, Inc.
  • Canada
View GitHub Profile
@cgmb
cgmb / test-omp-offload.sh
Created January 22, 2026 20:11
OpenMP AMDGPU Offloading
#!/bin/sh
# Test of OpenMP AMDGPU Offloading on Debian Forky and Ubuntu Resolute
set -eux
apt install hipcc libomp-21-dev liboffload-21-dev clang clang-tools build-essential git
git clone https://github.com/ROCm/aomp.git -b rocm-7.2.0
cd aomp/test/smoke/veccopy
make # or use "clang -O2 -fopenmp --offload-arch=native veccopy.c -o veccopy"
@cgmb
cgmb / docker-files.sh
Created January 6, 2026 19:38
Bash functions for identifying containers by files in root
function docker-files {
docker diff "$1" | cut -d/ -f2,3 | fgrep 'root/' | grep -v 'root/\.' | sed 's_root/__' | uniq
}
function docker-files-all {
local container_ids=$(docker ps -a | cut -d' ' -f1 | sed -n '1d;p')
for container_id in $container_ids; do
echo "$container_id:"
docker-files "$container_id" | sed 's/^/ /'
done
@cgmb
cgmb / install-fooocus.sh
Last active March 10, 2025 05:47
Install Fooocus on Debian Unstable
#!/bin/bash
# Install Foocus on Debian Unstable on PyTorch Nightly (Tested on of 2025-03-09)
# Tested running in Docker as the root user
cd ~
apt -y update
apt -y upgrade
apt -y install bzip2 ca-certificates gfortran git gzip lsb-release patch python3 tar unzip xz-utils zstd build-essential cmake python3-dev python3-full meson pkg-config cargo libopenblas-dev libgit2-dev
git clone -c feature.manyFiles=true https://github.com/spack/spack.git
cd spack
@cgmb
cgmb / Meta-Llama-3.1-8B-Instruct-Q6_K_bench.log
Created February 7, 2025 01:04
rocblas and llama.cpp performance profiling
./rocblas-bench -f gemm_batched_ex --transposeA T --transposeB N -m 32 -n 2 -k 128 --alpha 1 --a_type f16_r --lda 1024 --b_type f16_r --ldb 4096 --beta 0 --c_type f32_r --ldc --d_type f32_r --ldd 32 --batch_count 32 --compute_type f32_r --algo 0 --solution_index 0 --flags 1
./rocblas-bench -f gemm_batched_ex --transposeA T --transposeB N -m 128 -n 2 -k 32 --alpha 1 --a_type f16_r --lda 2048 --b_type f16_r --ldb 32 --beta 0 --c_type f16_r --ldc --d_type f16_r --ldd 128 --batch_count 32 --compute_type f16_r --algo 0 --solution_index 0 --flags 1
./rocblas-bench -f gemm_batched_ex --transposeA T --transposeB N -m 32 -n 2 -k 128 --alpha 1 --a_type f16_r --lda 1024 --b_type f16_r --ldb 4096 --beta 0 --c_type f32_r --ldc --d_type f32_r --ldd 32 --batch_count 32 --compute_type f32_r --algo 0 --solution_index 0 --flags 1
./rocblas-bench -f gemm_batched_ex --transposeA T --transposeB N -m 128 -n 2 -k 32 --alpha 1 --a_type f16_r --lda 2048 --b_type f16_r --ldb 32 --beta 0 --c_type f16_r --ldc --d_type f16_r --ldd 128 --
@cgmb
cgmb / build-magma.sh
Last active December 19, 2024 20:38
Build magma for HIP
#!/bin/bash
# Build Magma on Ubuntu 24.04
set -eux
export CXX=hipcc
apt-get -y update
apt-get -y upgrade
apt-get -y install git cmake build-essential libopenblas-dev gfortran hipcc librocblas-dev libhipblas-dev librocsparse-dev libhipsparse-dev
git clone https://github.com/icl-utk-edu/magma.git
@cgmb
cgmb / build-llama-cpp.sh
Last active October 19, 2025 09:58
Build llama.cpp on Ubuntu 24.04
#!/bin/sh
# Build llama.cpp on Ubuntu 24.04 with AMD GPU support
sudo apt -y install git wget hipcc libhipblas-dev librocblas-dev cmake build-essential
# ensure you have the necessary permissions by adding yourself to the video and render groups
sudo usermod -aG video,render $USER
# reboot to apply the group changes
# run rocminfo to check everything is working thus far
@cgmb
cgmb / spack-rocm-packages.txt
Created October 20, 2024 11:54
List of Spack packages with ROCm support
adios2
aluminum
amg2023
amrex
amr-wind
arborx
axom
babelstream
beatnik
blaspp
@cgmb
cgmb / pbuilder-failure.txt
Created April 2, 2024 22:25
pbuilder failure
$ pbuilder-dist noble amd64 create
W: /home/cgmb/.pbuilderrc does not exist
I: Logging to /home/cgmb/pbuilder/noble_result/last_operation.log
I: Distribution is noble.
I: Current time: Tue Apr 2 16:24:12 MDT 2024
I: pbuilder-time-stamp: 1712096652
I: Building the build environment
I: running debootstrap
/usr/sbin/debootstrap
I: Target architecture can be executed
@cgmb
cgmb / check-apt.sh
Created April 1, 2024 18:24
Ubuntu Noble package list check
#!/bin/bash
set -euo pipefail
wget -qO- http://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/by-hash/SHA256/8341b8ac157e16be21c3dd6439abf8aa27c3815879f2a9d5164881f7ba0dd0e2 | xz -d > noble-packages.txt
grep '^Package: apt$' noble-packages.txt
@cgmb
cgmb / build-llama-cpp-fedora.sh
Last active April 16, 2025 14:23
How to build llama.cpp on fedora
#!/bin/sh
# Build llama.cpp on Fedora 40 and later
# Tested with `docker run -it --device=/dev/dri --device=/dev/kfd --security-opt seccomp=unconfined --volume $HOME:/mnt/home fedora:40`
dnf -y update
dnf -y install hipcc rocm-hip-devel rocblas-devel hipblas-devel git cmake g++ lld clang-tools-extra llvm
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp/
git checkout b2110
CC=clang CXX=clang++ cmake -H. -Bbuild -DLLAMA_HIPBLAS=ON -DAMDGPU_TARGETS="gfx1030;gfx1100;gfx1101;gfx1102" -DCMAKE_BUILD_TYPE=Release