I want to pre-package the tools necessary to read performance parameters of AMD GPUs. The package is rocm_smi_lib
, which includes an .so
library provides an API for access and a python script that works as a command line interface. The BinaryBuilder script for compiling the .so
library is fairly trivial and I have it working now. What is the appropriate way to package the python file, so that I can run it from my Julia code?
Running the python file from Julia “manually”, without using all of the jll
functionality also works fine, so the question is specifically about packaging conventions.
Long term it would be great to just write a Julia script that interfaces with the .so
, but I would prefer to start with something that requires less work.
For reference, here is the build script:
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg
name = "rocm_smi_lib"
version = v"4.0.0"
# Collection of sources required to complete build
sources = [
ArchiveSource("https://github.com/RadeonOpenCompute/rocm_smi_lib/archive/refs/tags/rocm-$(version).tar.gz", "93d19229b5a511021bf836ddc2a9922e744bf8ee52ee0e2829645064301320f4")
]
# Bash recipe for building across all platforms
script = raw"""
cd ${WORKSPACE}/srcdir/rocm_smi_lib-rocm-*/
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_PREFIX_PATH=${prefix} ..
make -j${nproc}
make install
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Platform("x86_64", "linux"; libc = "glibc")
]
# The products that we will ensure are always built
products = [
LibraryProduct("liboam", :liboam, "oam/lib"),
LibraryProduct("librocm_smi64", :librocm_smi, "rocm_smi/lib")
]
# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="hsa_rocr_jll", uuid="dd59ff1a-a01a-568d-8b29-0669330f116a"))
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"8.1.0")
@jpsamaroo , pinging you in case this is of interest, as it relates to AMDGPU.