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 / build-debian-rocrand.sh
Last active September 4, 2022 06:50
Build rocRAND using Debian dependencies
#!/usr/bin/env bash
apt install git build-essential cmake libgtest-dev \
rocm-cmake rocminfo libamd-comgr-dev libhsakmt-dev \
libhsa-runtime-dev file hipcc
git clone https://github.com/ROCmSoftwarePlatform/rocRAND.git
cd rocRAND
git checkout rocm-5.2.0
# These environment variables are needed for now.
@cgmb
cgmb / build-rocm-5.2.sh
Last active July 13, 2022 22:50
Build ROCm 5.2.0 on Ubuntu 20.04
#!/usr/bin/env bash
# Build ROCm 5.2.0 on Ubuntu 20.04
set -exuo pipefail
apt-get -qq update
apt-get -qq upgrade
apt-get -qq install build-essential cmake wget
WORKSPACE=$HOME # where to download and build the sources
@cgmb
cgmb / build.sh
Created July 12, 2022 08:06
How to build rocm-hipamd
# install basic tools
sudo apt install build-essential devscripts packaging-dev git vim dos2unix
# setup workspace to build in
mkdir hip
cd hip
gbp clone https://salsa.debian.org/rocm-team/rocm-hipamd.git
cd rocm-hipamd
gbp export-orig
@cgmb
cgmb / dpp-builtin-feature-test.cpp
Created July 6, 2022 01:16
Comparison of approaches to forward source compatability for new architectures
#include <hip/hip_runtime.h>
/*
* Feature Test: Test if DPP is supported. Use DPP if supported;
* use fallback if not.
*
* Pros: Successful compilation by default.
* Maybe optimal performance by default?
* Cons: The compiler would have to provide some way to test if the
* necessary DPP functionality is supported. That might not exist yet.
@cgmb
cgmb / build-log.txt
Created July 5, 2022 23:55
Misuse of __builtin_amdgcn_mov_dpp
$ hipcc -c dpp-builtin.cpp --offload-arch=gfx906
$ hipcc -c dpp-builtin.cpp --offload-arch=gfx1030
error: Illegal instruction detected: Invalid dpp_ctrl value: broadcasts are not supported on GFX10+
renamable $vgpr0 = V_MOV_B32_dpp undef $vgpr0(tied-def 0), killed $vgpr0, 323, 12, 15, 0, implicit $exec
1 error generated when compiling for gfx1030.
@cgmb
cgmb / spack-modules-example.sh
Last active June 16, 2022 21:22
An example of using spack with modules
#!/usr/bin/env bash
# Ubuntu 20.04 example of using modules files generated by Spack
# See also https://spack.readthedocs.io/en/latest/module_file_support.html
sudo apt -y install git unzip openssl python3 python3-dev python3-distutils build-essential gfortran
git clone -b v0.18.0 https://github.com/spack/spack.git
# Here we would normally source spack/share/spack/setup-env.sh,
# but that's only really needed for `spack load`. We're going to
# use modules instead of `spack load`, so we can skip that.
@cgmb
cgmb / debian-hip-build-2022-05-01.sh
Last active May 2, 2022 03:11
Build HIP on Debian Sid
#!/usr/bin/env bash
set -exuo pipefail
apt-get -qq update
apt-get -qq upgrade
apt-get -qq install build-essential cmake python3 wget perl file \
clang libclang-dev libamd-comgr-dev rocm-device-libs rocm-cmake libhsakmt-dev libhsa-runtime-dev \
zlib1g-dev libnuma-dev mesa-common-dev
@cgmb
cgmb / debian-rocm-build-2.sh
Last active February 16, 2022 02:56
Debian ROCm build script MkII
#!/usr/bin/env bash
# A build script for ROCm 5.0 on Debian Sid. Run this script in a
# docker container started with permissions like these:
#
# docker run -it --device=/dev/dri --device=/dev/kfd \
# --security-opt seccomp=unconfined \
# --group-add=video \
# --net host \
# debian:sid
@cgmb
cgmb / CMakeLists.txt
Created February 8, 2022 10:10
fmt 8.1 tuple_join_view example
cmake_minimum_required(VERSION 3.16)
project(ExampleVcpkgIfort LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
find_package(fmt REQUIRED)
add_executable(ex example.cpp)
target_link_libraries(ex fmt::fmt)
@cgmb
cgmb / rocsolver-fhs.patch
Created February 8, 2022 09:50
Fix rocSOLVER system install
diff -ru a/rocSOLVER-rocm-4.5.2/library/src/CMakeLists.txt b/rocSOLVER-rocm-4.5.2/library/src/CMakeLists.txt
--- a/rocSOLVER-rocm-4.5.2/library/src/CMakeLists.txt 2021-10-11 12:24:22.000000000 -0600
+++ b/rocSOLVER-rocm-4.5.2/library/src/CMakeLists.txt 2022-02-08 01:18:46.093325505 -0700
@@ -251,16 +251,13 @@
INCLUDE
${CMAKE_SOURCE_DIR}/library/include
${CMAKE_BINARY_DIR}/include
- PREFIX rocsolver
)