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 / 0001-Guard-use-of-OpenMP-to-make-it-optional.patch
Created April 25, 2023 16:05
Make OpenMP optional in rocBLAS
From fd158ca247274b593ec59892385a1e66c96fb9a6 Mon Sep 17 00:00:00 2001
From: Cordell Bloor <Cordell.Bloor@amd.com>
Date: Thu, 13 Apr 2023 17:55:03 -0600
Subject: [PATCH] Guard use of OpenMP to make it optional
This change allows rocBLAS to compile and run even when OpenMP is not
available.
---
clients/common/blis_interface.cpp | 4 +-
clients/common/cblas_interface.cpp | 20 ++++++++++
@cgmb
cgmb / rocsolver_rfinfo.cpp
Created March 31, 2023 11:01
Example of C++-style error handling
/* ************************************************************************
* Copyright (c) 2023 Advanced Micro Devices, Inc.
* ************************************************************************ */
#include <new>
#include "rocsolver_rfinfo.hpp"
extern "C" rocblas_status rocsolver_create_rfinfo(rocsolver_rfinfo* rfinfo, rocblas_handle handle)
{
@cgmb
cgmb / rocsolver_rfinfo.cpp
Last active March 31, 2023 16:39
Example of C-style error handling
/* ************************************************************************
* Copyright (c) 2023 Advanced Micro Devices, Inc.
* ************************************************************************ */
#include <stdlib.h>
#include <rocblas/rocblas.h>
#include <rocsparse/rocsparse.h>
#include "rocsolver_rfinfo.hpp"
@cgmb
cgmb / CMakeLists.txt
Last active December 4, 2023 03:58
Setup ROCm on a G4ad instance
cmake_minimum_required(VERSION 3.16)
project(example LANGUAGES CXX)
find_package(hip REQUIRED)
add_executable(example main.cpp)
target_link_libraries(example PRIVATE hip::device)
@cgmb
cgmb / CMakeLists.txt
Last active February 22, 2023 18:58
Using perf on Ubuntu 20.04
cmake_minimum_required(VERSION 3.16)
project(rocblas-init-benchmark)
find_package(rocblas REQUIRED)
add_executable(rbi main.c)
target_link_libraries(rbi PRIVATE roc::rocblas)
@cgmb
cgmb / CMakeLists.txt
Last active February 22, 2023 18:59
profile rocblas_initialize() on Ubuntu 20.04
cmake_minimum_required(VERSION 3.16)
project(rocblas-init-benchmark)
find_package(rocblas REQUIRED)
add_executable(rbi main.c)
target_link_libraries(rbi PRIVATE roc::rocblas)
@cgmb
cgmb / build-rocm-5.4.2.sh
Created January 31, 2023 18:40
Build ROCm for Ubuntu 20.04
#!/usr/bin/env bash
# Build rocBLAS for ROCm 5.4.2 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 January 17, 2023 23:17
Clang offload bundle example
#!/bin/sh
/opt/rocm/llvm/bin/clang++ --offload-arch=gfx906:xnack- -L/opt/rocm/hip/lib -lamdhip64 ex.hip
@cgmb
cgmb / hip-build-platform.md
Last active November 21, 2022 15:01
HIP platform selection
  1. In the install script, determine the build platform by querying [hipconfig --platform][4]
    • This is necessary, as the install script needs to know the build platform so it can to choose what dependencies to install.
    • hipconfig --platform determines the platform by reading the contents of the .hipInfo file installed as part of the hip runtime.
    • If the platform is autodetected incorrectly, [it can be be set explicitly via an environment variable][1], e.g., export HIP_PLATFORM=amd or export HIP_PLATFORM=nvidia.
  2. In CMake, find_package(hip REQUIRED) will be used for both the AMD and NVIDIA platforms.
    • There will be no need for a different find_package call on each platform; the same call will be used for both platforms.
@cgmb
cgmb / debian-workflow.sh
Created September 18, 2022 20:39
Working with Debian
#!/bin/sh
apt-get update -y
apt-get upgrade -y
apt-get install -y build-essential devscripts packaging-dev git vim
useradd -G sudo,video --shell /bin/bash --create-home cgmb
echo 'cgmb ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
gbp clone https://salsa.debian.org/rocm-team/rocm-hipamd.git
cd rocm-hipamd