interplane.Get Omega
Read in your language

omega-blas

aien-dev/omega-blas

Brought by drakestapleton

branch main Branches Tags History

omega-blas / Makefile

46 lines · 1958 bytes Raw Blame History
1# omega-blas build. The compute unit om/blas.om is compiled by the pinned OM-2 omc and bound by
2# omega-bridge tools/native (ABI v2); libomegablas.so links that binding with the interim C layer.
3# make BRIDGE=<omega-bridge checkout> OMC=<seeded omc> OMC2=<OM-2 omc>
4# make ... GB10=1 CUDAPP=<CUDApp checkout> the GB10 device path (README.md), into build-gb10/:
5# links CUDApp's libomega_gpu.a, built position-independent into $(CUDAPP)/build/omegablas-pic
6# Pins: see PINS (parent omega-mv sha, omc sha256s, omega-bridge sha, CUDApp sha).
7BRIDGE ?= ../omega-bridge
8OMC ?= $(error set OMC to the seeded omc (sha256 in PINS))
9OMC2 ?= $(error set OMC2 to the OM-2 omc (sha256 in PINS))
10CC ?= cc
11CFLAGS ?= -O2
12GB10 ?= 0
13N := build/native
14ifeq ($(GB10),1)
15CUDAPP ?= $(error set CUDAPP to a CUDApp checkout (sha in PINS))
16B := build-gb10
17GPU_LIB := $(CUDAPP)/build/omegablas-pic/libomega_gpu.a
18GPU_CFLAGS := -DOMB_GB10 -I$(CUDAPP)/src \
19 -DOMB_CUDAPP_REV='"$(shell git -C $(CUDAPP) rev-parse HEAD)$(shell git -C $(CUDAPP) diff --quiet HEAD || echo -dirty)"'
20GPU_LIBS := $(GPU_LIB) -lm
21else
22B := build
23endif
24
25all: $(B)/libomegablas.so
26
27$(N)/omega_native.c: om/blas.om
28 OMEGA_NATIVE_OMC=$(OMC) OMEGA_NATIVE_OMC2=$(OMC2) $(BRIDGE)/tools/native $(N) om/blas.om
29
30$(B)/libomegablas.so: $(N)/omega_native.c src/omegablas.c include/omegablas.h $(GPU_LIB)
31 mkdir -p $(B)
32 $(CC) -std=gnu11 $(CFLAGS) -Wall -Wextra -Werror -fPIC -shared -Wl,-soname,libomegablas.so \
33 -Iinclude -I$(N) -include $(N)/omega_native.h $(GPU_CFLAGS) -o $@ src/omegablas.c \
34 $(N)/omega_native.c $(GPU_LIBS) -lpthread
35
36ifeq ($(GB10),1)
37# CUDApp's own build with -fPIC added to the compiler; its CFLAGS, including the gemm_ex
38# migration-pending switch of mk/gemm-ex.mk, stay as CUDApp sets them.
39$(GPU_LIB): FORCE
40 $(MAKE) -C $(CUDAPP) OUT_DIR=build/omegablas-pic CC="$(CC) -fPIC" build/omegablas-pic/libomega_gpu.a
41endif
42
43clean:
44 rm -rf build build-gb10
45
46.PHONY: all clean FORCE