From b633fcdcf7bb0b27e535a0f5a6d9a32550fb6cdb Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 15:25:47 -0400 Subject: [PATCH 01/15] WIP --- CMakeLists.txt | 14 +++++++++++++- Dockerfile | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c434c6a..2615769 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,10 +26,22 @@ add_compile_options( include(FetchContent) +set(CUDA_VERSION "cpu" CACHE STRING "CUDA version (cpu, 12.6, 12.8, 13.0)") + if(APPLE) # Target Apple Silicon (M1/M2/M3) set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.10.0.zip") + message(STATUS "TGUF: Target System is APPLE (ARM64). Using CPU LibTorch.") else() # Target Linux x86_64 - set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.10.0%2Bcpu.zip") + if(CUDA_VERSION STREQUAL "cpu") + set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.10.0%2Bcpu.zip") + message(STATUS "TGUF: Target System is LINUX (CPU).") + else() + # Clean "12.6" -> "126" for the URL mapping + string(REPLACE "." "" CUDA_TAG ${CUDA_VERSION}) + set(LIBTORCH_URL "https://download.pytorch.org/libtorch/cu${CUDA_TAG}/libtorch-shared-with-deps-2.10.0%2Bcu${CUDA_TAG}.zip") + message(STATUS "TGUF: Target System is LINUX (CUDA ${CUDA_VERSION}).") + enable_language(CUDA) + endif() endif() FetchContent_Declare( diff --git a/Dockerfile b/Dockerfile index 8711ff5..ae20ec9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM ubuntu:24.04 +ARG CUDA_VER=cpu # Default is "cpu". Pass "12.6", "12.8", or "13.0" to trigger CUDA install. ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ @@ -11,12 +12,23 @@ RUN apt-get update && apt-get install -y \ make \ git \ curl \ + wget \ ca-certificates \ + && \ + if [ "$CUDA_VER" != "cpu" ]; then \ + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \ + dpkg -i cuda-keyring_1.1-1_all.deb && \ + apt-get update && \ + PACKAGE_SUFFIX=$(echo $CUDA_VER | sed 's/\./-/g') && \ + apt-get install -y cuda-toolkit-${PACKAGE_SUFFIX} ; \ + fi \ && rm -rf /var/lib/apt/lists/* COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/ ENV CC=clang ENV CXX=clang++ +ENV PATH=${CUDA_VER:+/usr/local/cuda-${CUDA_VER}/bin:}${PATH} +ENV LD_LIBRARY_PATH=${CUDA_VER:+/usr/local/cuda-${CUDA_VER}/lib64:}${LD_LIBRARY_PATH} WORKDIR /workspace From b293b74717dc5a2ebdea627c7b8807b0f5426791 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 15:56:44 -0400 Subject: [PATCH 02/15] WIP --- .github/workflows/ci.yml | 42 +++++++++++++++++++++---------- .github/workflows/integration.yml | 30 ++++++++++++++++------ Dockerfile | 10 ++++---- Makefile | 27 +++++++++++++++++++- README.md | 13 ++++++++++ 5 files changed, 95 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab0c0c2..b215116 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,26 @@ on: # yamllint disable-line rule:truthy jobs: build: + name: Build (${{ matrix.os }}, ${{ matrix.cuda_version }}, ${{ matrix.build_type }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # Testing across Linux and macOS os: [ubuntu-latest, macos-latest] - build_type: [Debug, Release] + build_type: [Release] + cuda_version: [cpu, 12.6, 12.8, 13.0] + include: + - os: ubuntu-latest + cuda_version: cpu + build_type: Debug + exclude: + - os: macos-latest + cuda_version: 12.6 + - os: macos-latest + cuda_version: 12.8 + - os: macos-latest + cuda_version: 13.0 steps: - uses: actions/checkout@v4 @@ -31,12 +44,12 @@ jobs: run: brew install libomp - name: Build TGN - run: make build BUILD_TYPE=${{ matrix.build_type }} + run: make build BUILD_TYPE=${{ matrix.build_type }} CUDA_VERSION=${{ matrix.cuda_version }} - name: Upload Build Artifacts uses: actions/upload-artifact@v4 with: - name: build-${{ matrix.os }}-${{ matrix.build_type }} + name: build-${{ matrix.os }}-${{ matrix.cuda_version }}-${{ matrix.build_type }} path: build/ test: @@ -51,10 +64,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download Debug Build + - name: Download CPU Debug Build uses: actions/download-artifact@v4 with: - name: build-${{ matrix.os }}-Debug + name: build-${{ matrix.os }}-cpu-Debug path: build/ - name: Install OpenMP (MacOS) @@ -70,10 +83,10 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Download Debug Build + - name: Download CPU Debug Build uses: actions/download-artifact@v4 with: - name: build-ubuntu-latest-Debug + name: build-ubuntu-latest-cpu-Debug path: build/ - uses: cpp-linter/cpp-linter-action@v2 @@ -87,17 +100,20 @@ jobs: test-on-container: runs-on: ubuntu-latest + strategy: + matrix: + cuda_version: [cpu, 12.6, 12.8, 13.0] steps: - uses: actions/checkout@v4 - name: Build TGN Container - run: docker build -t tgn-dev . + run: docker build --build-arg CUDA_VERSION=${{ matrix.cuda_version }} -t tgn-dev:${{ matrix.cuda_version }} . - name: Run Tests inside Container run: | - docker run --rm \ - -v "$(pwd):/workspace:Z" \ - tgn-dev /bin/bash -c "make test" + # If CPU, run tests. If CUDA, just run build to verify compilation. + CMD=$([[ "${{ matrix.cuda_version }}" == "cpu" ]] && echo "make test" || echo "make build") + docker run --rm -v "$(pwd):/workspace:Z" tgn-dev:${{ matrix.cuda_version }} /bin/bash -c "$CMD" python-tests: needs: build @@ -111,10 +127,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Download Build Artifacts + - name: Download CPU Release Build uses: actions/download-artifact@v4 with: - name: build-${{ matrix.os }}-Release + name: build-${{ matrix.os }}-cpu-Release path: build/ - name: Setup uv diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1d9138d..bfb928c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,12 +10,22 @@ on: # yamllint disable-line rule:truthy jobs: build-all: + name: Build (${{ matrix.os }}, ${{ matrix.cuda_version }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # Testing across Linux and macOS os: [ubuntu-latest, macos-latest] + build_type: [Release] + cuda_version: [cpu, 12.6, 12.8, 13.0] + exclude: + - os: macos-latest + cuda_version: 12.6 + - os: macos-latest + cuda_version: 12.8 + - os: macos-latest + cuda_version: 13.0 steps: - uses: actions/checkout@v4 @@ -30,12 +40,12 @@ jobs: run: brew install libomp - name: Build TGN Examples - run: make examples BUILD_TYPE=Release + run: make examples BUILD_TYPE=Release CUDA_VERSION=${{ matrix.cuda_version }} - name: Upload Build Artifact uses: actions/upload-artifact@v4 with: - name: build-${{ matrix.os }}-Release + name: build-${{ matrix.os }}-${{ matrix.cuda_version }}-Release path: build/ link-pred: @@ -53,7 +63,7 @@ jobs: - name: Download Build Artifact uses: actions/download-artifact@v4 with: - name: build-${{ matrix.os }}-Release + name: build-${{ matrix.os }}-cpu-Release path: build/ - name: Restore Binary Permissions @@ -87,7 +97,7 @@ jobs: - name: Download Build Artifact uses: actions/download-artifact@v4 with: - name: build-${{ matrix.os }}-Release + name: build-${{ matrix.os }}-cpu-Release path: build/ - name: Restore Binary Permissions @@ -107,15 +117,19 @@ jobs: run: make run-node-${{ matrix.dataset }} node-pred-on-container: + name: Container Integration (${{ matrix.cuda_version }}) runs-on: ubuntu-latest + strategy: + matrix: + cuda_version: [cpu, 12.6, 12.8, 13.0] steps: - uses: actions/checkout@v4 - name: Build TGN Container - run: docker build -t tgn-dev . + run: docker build --build-arg CUDA_VERSION=${{ matrix.cuda_version }} -t tgn-dev:${{ matrix.cuda_version }} . - name: Run Node Prediction run: | - docker run --rm \ - -v "$(pwd):/workspace:Z" \ - tgn-dev /bin/bash -c "make run-node-tgbn-trade" + # If CPU: run full node prediction. If CUDA: just verify 'make examples' compiles. + CMD=$([[ "${{ matrix.cuda_version }}" == "cpu" ]] && echo "make run-node-tgbn-trade" || echo "make examples") + docker run --rm -v "$(pwd):/workspace:Z" tgn-dev /bin/bash -c "$CMD" diff --git a/Dockerfile b/Dockerfile index ae20ec9..521ead5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM ubuntu:24.04 -ARG CUDA_VER=cpu # Default is "cpu". Pass "12.6", "12.8", or "13.0" to trigger CUDA install. +ARG CUDA_VERSION=cpu # Default is "cpu". Pass "12.6", "12.8", or "13.0" to trigger CUDA install. ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ @@ -15,11 +15,11 @@ RUN apt-get update && apt-get install -y \ wget \ ca-certificates \ && \ - if [ "$CUDA_VER" != "cpu" ]; then \ + if [ "$CUDA_VERSION" != "cpu" ]; then \ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \ dpkg -i cuda-keyring_1.1-1_all.deb && \ apt-get update && \ - PACKAGE_SUFFIX=$(echo $CUDA_VER | sed 's/\./-/g') && \ + PACKAGE_SUFFIX=$(echo $CUDA_VERSION | sed 's/\./-/g') && \ apt-get install -y cuda-toolkit-${PACKAGE_SUFFIX} ; \ fi \ && rm -rf /var/lib/apt/lists/* @@ -28,7 +28,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/ ENV CC=clang ENV CXX=clang++ -ENV PATH=${CUDA_VER:+/usr/local/cuda-${CUDA_VER}/bin:}${PATH} -ENV LD_LIBRARY_PATH=${CUDA_VER:+/usr/local/cuda-${CUDA_VER}/lib64:}${LD_LIBRARY_PATH} +ENV PATH=${CUDA_VERSION:+/usr/local/cuda-${CUDA_VERSION}/bin:}${PATH} +ENV LD_LIBRARY_PATH=${CUDA_VERSION:+/usr/local/cuda-${CUDA_VERSION}/lib64:}${LD_LIBRARY_PATH} WORKDIR /workspace diff --git a/Makefile b/Makefile index dbd0205..8d4858c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,27 @@ BUILD_DIR := build PROFILE_DIR := build-profile -CMAKE_FLAGS := -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + +CUDA_VERSION ?= cpu +GPU_ARCH ?= native + +CMAKE_FLAGS := -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCUDA_VERSION=$(CUDA_VERSION) + +ifneq ($(CUDA_VERSION), cpu) + CMAKE_FLAGS += -DCMAKE_CUDA_ARCHITECTURES=$(GPU_ARCH) + + # Add Torch-specific Arch list (converts 80 -> 8.0) + ifneq ($(GPU_ARCH), native) + TORCH_ARCH := $(shell echo $(GPU_ARCH) | sed 's/\([0-9]\)\([0-9]\)/\1.\2/') + CMAKE_FLAGS += -DTORCH_CUDA_ARCH_LIST="$(TORCH_ARCH)" + endif + + # Handle CUDA Compiler Path (Look in standard /usr/local/cuda-X.Y) + CUDA_PATH := /usr/local/cuda-$(CUDA_VERSION) + ifneq ("$(wildcard $(CUDA_PATH)/bin/nvcc)","") + CMAKE_FLAGS += -DCMAKE_CUDA_COMPILER=$(CUDA_PATH)/bin/nvcc + endif +endif + NPROCS := $(shell nproc 2>/dev/null || sysctl -n hw.logicalcpu) EXAMPLE_LINK := $(BUILD_DIR)/examples/tgn_link_pred @@ -29,6 +50,10 @@ help: @echo " make examples - Build tgn_link_prop and tgn_node_prop examples" @echo " make clean - Remove build directory" @echo "" + @echo "Build Parameters (Optional):" + @echo " CUDA_VERSION= - Build for CUDA (e.g., 12.6, 12.8, 13.0). Default: cpu" + @echo " GPU_ARCH= - Compute capability (e.g., 80, 90, native). Default: native" + @echo "" @echo "Documentation Targets:" @echo " make docs - Build project documentation" @echo " make docs-serve - Build and serve project documentation" diff --git a/README.md b/README.md index 79252f6..77a061f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ ![Clang](https://img.shields.io/badge/Compiler-Clang-orange?style=flat&labelColor=white&logo=clang&logoColor=black) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=flat&logo=linux&logoColor=black) ![macOS](https://img.shields.io/badge/macOS-000000?style=flat&logo=apple&logoColor=white) +![CUDA 12.6](https://img.shields.io/badge/CUDA-12.6-green?logo=nvidia&logoColor=white) +![CUDA 12.8](https://img.shields.io/badge/CUDA-12.8-green?logo=nvidia&logoColor=white) +![CUDA 13.0](https://img.shields.io/badge/CUDA-13.0-green?logo=nvidia&logoColor=white) [![Docs](https://img.shields.io/readthedocs/tgncpp?style=flat&label=Docs&labelColor=white&logo=readthedocs&logoColor=black)](https://tgncpp.readthedocs.io/en/latest/?badge=latest) [![Tests](https://img.shields.io/github/actions/workflow/status/Jacob-Chmura/tgn.cpp/ci.yml?label=Tests&style=flat&labelColor=white&logo=github-actions&logoColor=black)](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/ci.yml) @@ -73,3 +76,13 @@ make run-link-tgbl-wiki # Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp make run-node-tgbn-trade ``` + +### CI Status + +| Target | Platform | Status | +| :------------ | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| **Linux CPU** | Ubuntu | ![CPU](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+cpu%29) | +| **macOS CPU** | Apple Silicon | ![macOS](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28macos-latest%2C+cpu%29) | +| **CUDA 13.0** | Ubuntu | ![CUDA 13.0](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+13.0%29) | +| **CUDA 12.6** | Ubuntu | ![CUDA 12.6](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+12.6%29) | +| **CUDA 12.8** | Ubuntu | ![CUDA 12.8](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+12.8%29) | From 5a9e5caecbb6e4a8ad2fbf5d919037d5f0667070 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:14:56 -0400 Subject: [PATCH 03/15] WIP --- .github/workflows/ci.yml | 18 ++++------------ .github/workflows/integration.yml | 14 ++++--------- README.md | 34 +++++++++++++++++++++++++------ 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b215116..f678ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,26 +9,15 @@ on: # yamllint disable-line rule:truthy jobs: build: - name: Build (${{ matrix.os }}, ${{ matrix.cuda_version }}, ${{ matrix.build_type }}) + name: Build (${{ matrix.os }} ${{ matrix.build_type }}, CUDA=${{ matrix.cuda_version }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: # Testing across Linux and macOS os: [ubuntu-latest, macos-latest] - build_type: [Release] - cuda_version: [cpu, 12.6, 12.8, 13.0] - include: - - os: ubuntu-latest - cuda_version: cpu - build_type: Debug - exclude: - - os: macos-latest - cuda_version: 12.6 - - os: macos-latest - cuda_version: 12.8 - - os: macos-latest - cuda_version: 13.0 + build_type: [Debug, Release] + cuda_version: [cpu] # Cuda builds are tested on our containers steps: - uses: actions/checkout@v4 @@ -99,6 +88,7 @@ jobs: tidy-checks: "" # Use .clang-tidy config file test-on-container: + name: Container Build (Cuda=${{ matrix.cuda_version }}) runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index bfb928c..5e4fc3d 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,7 +10,7 @@ on: # yamllint disable-line rule:truthy jobs: build-all: - name: Build (${{ matrix.os }}, ${{ matrix.cuda_version }}) + name: Build (${{ matrix.os }}, CUDA=${{ matrix.cuda_version }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -18,14 +18,8 @@ jobs: # Testing across Linux and macOS os: [ubuntu-latest, macos-latest] build_type: [Release] - cuda_version: [cpu, 12.6, 12.8, 13.0] - exclude: - - os: macos-latest - cuda_version: 12.6 - - os: macos-latest - cuda_version: 12.8 - - os: macos-latest - cuda_version: 13.0 + cuda_version: [cpu] # Cuda builds are tested on our containers + steps: - uses: actions/checkout@v4 @@ -117,7 +111,7 @@ jobs: run: make run-node-${{ matrix.dataset }} node-pred-on-container: - name: Container Integration (${{ matrix.cuda_version }}) + name: Container Integration (CUDA=${{ matrix.cuda_version }}) runs-on: ubuntu-latest strategy: matrix: diff --git a/README.md b/README.md index 77a061f..1f7ac58 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ ![Clang](https://img.shields.io/badge/Compiler-Clang-orange?style=flat&labelColor=white&logo=clang&logoColor=black) ![Linux](https://img.shields.io/badge/Linux-FCC624?style=flat&logo=linux&logoColor=black) ![macOS](https://img.shields.io/badge/macOS-000000?style=flat&logo=apple&logoColor=white) -![CUDA 12.6](https://img.shields.io/badge/CUDA-12.6-green?logo=nvidia&logoColor=white) -![CUDA 12.8](https://img.shields.io/badge/CUDA-12.8-green?logo=nvidia&logoColor=white) -![CUDA 13.0](https://img.shields.io/badge/CUDA-13.0-green?logo=nvidia&logoColor=white) +![CUDA 12.6](https://img.shields.io/badge/CUDA-12.6-76B900?style=flat&labelColor=white&logo=nvidia&logoColor=76B900) +![CUDA 12.8](https://img.shields.io/badge/CUDA-12.8-76B900?style=flat&labelColor=white&logo=nvidia&logoColor=76B900) +![CUDA 13.0](https://img.shields.io/badge/CUDA-13.0-76B900?style=flat&labelColor=white&logo=nvidia&logoColor=76B900) [![Docs](https://img.shields.io/readthedocs/tgncpp?style=flat&label=Docs&labelColor=white&logo=readthedocs&logoColor=black)](https://tgncpp.readthedocs.io/en/latest/?badge=latest) [![Tests](https://img.shields.io/github/actions/workflow/status/Jacob-Chmura/tgn.cpp/ci.yml?label=Tests&style=flat&labelColor=white&logo=github-actions&logoColor=black)](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/ci.yml) @@ -36,7 +36,20 @@ A C++20 Port of [TGN](https://arxiv.org/abs/2006.10637) over pure LibTorch: ### Installation -You should just use the [Dockerfile](./Dockerfile), but if you prefer to install dependencies manually: +You should just use the [Dockerfile](./Dockerfile): + +```sh +# Build for CPU (default) +docker build -t tgn-dev:cpu . + +# Build for specific CUDA drivers (e.g. 12.6 for A100/H100) +docker build --build-arg CUDA_VERSION=12.6 -t tgn-dev:cu126 . +``` + +> \[!Note\] +> We support `CUDA_VERSION=12.6|12.8|13.0`. + +If you prefer a bare-metal install: ##### Linux @@ -70,13 +83,22 @@ git clone git@github.com:Jacob-Chmura/tgn.cpp.git && cd tgn.cpp # See available targets make help -# Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. +# [CPU] Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. make run-link-tgbl-wiki -# Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp +# [CPU] Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp make run-node-tgbn-trade + +# [GPU] Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. +CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki + +# [GPU] Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp +CUDA_VERSION=12.6 GPU_ARCH=80 make run-node-tgbn-trade ``` +> \[!TIP\] +> Use `nvidia-smi` to check your CUDA version and Architecture + ### CI Status | Target | Platform | Status | From e0c760e285960085f00a8c8a0e670d535636b7f7 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:18:44 -0400 Subject: [PATCH 04/15] WIP --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 5e4fc3d..3dd75b1 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -126,4 +126,4 @@ jobs: run: | # If CPU: run full node prediction. If CUDA: just verify 'make examples' compiles. CMD=$([[ "${{ matrix.cuda_version }}" == "cpu" ]] && echo "make run-node-tgbn-trade" || echo "make examples") - docker run --rm -v "$(pwd):/workspace:Z" tgn-dev /bin/bash -c "$CMD" + docker run --rm -v "$(pwd):/workspace:Z" tgn-dev:${{ matrix.cuda_version }} /bin/bash -c "$CMD" From ecb842f9e60c799e850506f164f384f1ebf3f2bb Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:40:13 -0400 Subject: [PATCH 05/15] WIP --- README.md | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1f7ac58..61fea6d 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,6 @@ docker build -t tgn-dev:cpu . docker build --build-arg CUDA_VERSION=12.6 -t tgn-dev:cu126 . ``` -> \[!Note\] -> We support `CUDA_VERSION=12.6|12.8|13.0`. - If you prefer a bare-metal install: ##### Linux @@ -65,6 +62,11 @@ sudo apt-get install -y clang libc++-dev libc++abi-dev brew install cmake libomp ``` +> \[!Important\] +> **Platform Suport**: +> - macOS: CPU (*Apple Silicon*) +> - Linux (Ubunut 22.04+): CPU and CUDA (12.6, 12.8, 13.0) + ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): ```sh @@ -73,38 +75,39 @@ curl -LsSf https://astral.sh/uv/install.sh | sh ### Usage -> \[!Note\] -> Tested on Linux (Ubuntu 22.04+) and macOS (Apple Silicon) +#### Setup ```sh # Clone the repo git clone git@github.com:Jacob-Chmura/tgn.cpp.git && cd tgn.cpp -# See available targets +# See all available targets make help +``` + +#### Running on CPU +```sh -# [CPU] Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. +# Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. make run-link-tgbl-wiki -# [CPU] Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp +# Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp make run-node-tgbn-trade +``` -# [GPU] Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. +#### Running on GPU (Linux only) +```sh +# Example: Cuda 12.6 on an A100 (Arch 80) CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki -# [GPU] Download `tgbn-trade` data, convert to `.tguf` and run examples/node_pred.cpp +# Example: Cuda 12.6 on an A100 (Arch 80) CUDA_VERSION=12.6 GPU_ARCH=80 make run-node-tgbn-trade ``` -> \[!TIP\] -> Use `nvidia-smi` to check your CUDA version and Architecture +| Variable | Description | Default | +|--------------|------------------------------------------------|----------| +| CUDA_VERSION | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | +| GPU_ARCH | Compute Capability (e.g. `80`, `90`, `native`) | `native` | -### CI Status - -| Target | Platform | Status | -| :------------ | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **Linux CPU** | Ubuntu | ![CPU](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+cpu%29) | -| **macOS CPU** | Apple Silicon | ![macOS](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28macos-latest%2C+cpu%29) | -| **CUDA 13.0** | Ubuntu | ![CUDA 13.0](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+13.0%29) | -| **CUDA 12.6** | Ubuntu | ![CUDA 12.6](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+12.6%29) | -| **CUDA 12.8** | Ubuntu | ![CUDA 12.8](https://github.com/Jacob-Chmura/tgn.cpp/actions/workflows/integration.yml/badge.svg?query=branch%3Amaster+job%3Abuild-all+%28ubuntu-latest%2C+12.8%29) | +> \[!TIP\] +> Use `nvidia-smi` to check your `CUDA_VERSION` and `GPU_ARCH` From b2e33adfe47eb11d2a2daa2bccaa98d05bf98508 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:42:30 -0400 Subject: [PATCH 06/15] WIP --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 61fea6d..132ca56 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,13 @@ brew install cmake libomp ``` > \[!Important\] -> **Platform Suport**: -> - macOS: CPU (*Apple Silicon*) -> - Linux (Ubunut 22.04+): CPU and CUDA (12.6, 12.8, 13.0) +> **Platform Support**: +> +> - macOS: +> - CPU (*Apple Silicon*) +> - Linux (Ubuntu 22.04+): +> - CPU (*x86_64*) +> - CUDA (12.6, 12.8, 13.0) ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): @@ -86,6 +90,7 @@ make help ``` #### Running on CPU + ```sh # Download `tgbl-wiki` data, convert to `.tguf` and run examples/link_pred.cpp. @@ -96,6 +101,7 @@ make run-node-tgbn-trade ``` #### Running on GPU (Linux only) + ```sh # Example: Cuda 12.6 on an A100 (Arch 80) CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki @@ -105,7 +111,7 @@ CUDA_VERSION=12.6 GPU_ARCH=80 make run-node-tgbn-trade ``` | Variable | Description | Default | -|--------------|------------------------------------------------|----------| +| ------------ | ---------------------------------------------- | -------- | | CUDA_VERSION | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | | GPU_ARCH | Compute Capability (e.g. `80`, `90`, `native`) | `native` | From 533e77da3bca801aef37e0d1e2f9e3612aa4fe76 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:45:56 -0400 Subject: [PATCH 07/15] WIP --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 132ca56..670aa40 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: > -> - macOS: +> macOS: > - CPU (*Apple Silicon*) -> - Linux (Ubuntu 22.04+): +> Linux (Ubuntu 22.04+): > - CPU (*x86_64*) > - CUDA (12.6, 12.8, 13.0) @@ -105,15 +105,14 @@ make run-node-tgbn-trade ```sh # Example: Cuda 12.6 on an A100 (Arch 80) CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki - -# Example: Cuda 12.6 on an A100 (Arch 80) -CUDA_VERSION=12.6 GPU_ARCH=80 make run-node-tgbn-trade ``` +
| Variable | Description | Default | | ------------ | ---------------------------------------------- | -------- | -| CUDA_VERSION | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | -| GPU_ARCH | Compute Capability (e.g. `80`, `90`, `native`) | `native` | +| *CUDA_VERSION* | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | +| *GPU_ARCH* | Compute Capability (e.g. `80`, `90`, `native`) | `native` | +
> \[!TIP\] -> Use `nvidia-smi` to check your `CUDA_VERSION` and `GPU_ARCH` +> Use `nvidia-smi` to check your *CUDA_VERSION* and *GPU_ARCH* From b473b5102dd117027dffbe81f4182b8983645a39 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:46:46 -0400 Subject: [PATCH 08/15] WIP --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 670aa40..40e0761 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ brew install cmake libomp > > macOS: > - CPU (*Apple Silicon*) +> > Linux (Ubuntu 22.04+): > - CPU (*x86_64*) > - CUDA (12.6, 12.8, 13.0) @@ -107,12 +108,10 @@ make run-node-tgbn-trade CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki ``` -
| Variable | Description | Default | | ------------ | ---------------------------------------------- | -------- | | *CUDA_VERSION* | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | | *GPU_ARCH* | Compute Capability (e.g. `80`, `90`, `native`) | `native` | -
> \[!TIP\] > Use `nvidia-smi` to check your *CUDA_VERSION* and *GPU_ARCH* From 3ddded0d0b588dfcd93d10f72825d7eb3e959b68 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:58:03 -0400 Subject: [PATCH 09/15] WIP --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 40e0761..a87b193 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ If you prefer a bare-metal install: sudo apt-get install -y clang libc++-dev libc++abi-dev ``` +If you want to run with CUDA support, refer to [nvidia docs](https://developer.nvidia.com/cuda-12-6-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local) for installation steps. + ##### MacOS ```sh @@ -64,13 +66,11 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: -> -> macOS: -> - CPU (*Apple Silicon*) -> -> Linux (Ubuntu 22.04+): -> - CPU (*x86_64*) -> - CUDA (12.6, 12.8, 13.0) + +> | Variable | Description | Options | Linux Support | macOS Support | Default | +> | ------------ | -------------------------------------------- | ----------------------------- | ------------------------- | -------------------------- | -------- | +> | CUDA_VERSION | CUDA backend version | `cpu`, `12.6`, `12.8`, `13.0` | All options supported | `cpu` only (Apple Silicon) | `cpu` | +> | GPU_ARCH | Compute Capability (GPU architecture target) | `80`, `90`, `native` | Supported when using CUDA | N/A | `native` | ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): @@ -108,10 +108,5 @@ make run-node-tgbn-trade CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki ``` -| Variable | Description | Default | -| ------------ | ---------------------------------------------- | -------- | -| *CUDA_VERSION* | CUDA Version: `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | -| *GPU_ARCH* | Compute Capability (e.g. `80`, `90`, `native`) | `native` | - > \[!TIP\] > Use `nvidia-smi` to check your *CUDA_VERSION* and *GPU_ARCH* From d19c25bcd8f224bd0c2386efa8e3f74215cdfa21 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 16:59:26 -0400 Subject: [PATCH 10/15] WIP --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a87b193..102c06b 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,10 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: -> | Variable | Description | Options | Linux Support | macOS Support | Default | +> | Variable | Description | Options | Linux | macOS | Default | > | ------------ | -------------------------------------------- | ----------------------------- | ------------------------- | -------------------------- | -------- | -> | CUDA_VERSION | CUDA backend version | `cpu`, `12.6`, `12.8`, `13.0` | All options supported | `cpu` only (Apple Silicon) | `cpu` | -> | GPU_ARCH | Compute Capability (GPU architecture target) | `80`, `90`, `native` | Supported when using CUDA | N/A | `native` | +> | CUDA_VERSION | CUDA backend version | `cpu`, `12.6`, `12.8`, `13.0` | All supported | `cpu` (Apple Silicon) | `cpu` | +> | GPU_ARCH | Compute Capability (GPU architecture) | `80`, `90`, `native` | All supprted | N/A | `native` | ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): From 1bd72d79730730cc1ed5c0b987dbf4e10fabc08f Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 17:00:48 -0400 Subject: [PATCH 11/15] WIP --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 102c06b..72a454a 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,8 @@ brew install cmake libomp > | Variable | Description | Options | Linux | macOS | Default | > | ------------ | -------------------------------------------- | ----------------------------- | ------------------------- | -------------------------- | -------- | -> | CUDA_VERSION | CUDA backend version | `cpu`, `12.6`, `12.8`, `13.0` | All supported | `cpu` (Apple Silicon) | `cpu` | -> | GPU_ARCH | Compute Capability (GPU architecture) | `80`, `90`, `native` | All supprted | N/A | `native` | +> | CUDA_VERSION | CUDA backend | `cpu`, `12.6`, `12.8`, `13.0` | All | `cpu` (Apple Silicon) | `cpu` | +> | GPU_ARCH | Compute Capability (GPU architecture) | `80`, `90`, `native` | All | N/A | `native` | ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): From 93d4de2e7c58882663db4cda256d57a57400fab7 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 17:01:44 -0400 Subject: [PATCH 12/15] WIP --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72a454a..68015c0 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ brew install cmake libomp > | Variable | Description | Options | Linux | macOS | Default | > | ------------ | -------------------------------------------- | ----------------------------- | ------------------------- | -------------------------- | -------- | > | CUDA_VERSION | CUDA backend | `cpu`, `12.6`, `12.8`, `13.0` | All | `cpu` (Apple Silicon) | `cpu` | -> | GPU_ARCH | Compute Capability (GPU architecture) | `80`, `90`, `native` | All | N/A | `native` | +> | GPU_ARCH | Compute Capability | `80`, `90`, `native` | All | N/A | `native` | ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): @@ -109,4 +109,4 @@ CUDA_VERSION=12.6 GPU_ARCH=80 make run-link-tgbl-wiki ``` > \[!TIP\] -> Use `nvidia-smi` to check your *CUDA_VERSION* and *GPU_ARCH* +> Use `nvidia-smi` to check your **CUDA_VERSION** and **GPU_ARCH** From 081c8dc2e8c7e6fc14b0fbb4ebd1cb7bec25bfbf Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 17:08:35 -0400 Subject: [PATCH 13/15] WIP --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 68015c0..0a2c09e 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,12 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: -> | Variable | Description | Options | Linux | macOS | Default | -> | ------------ | -------------------------------------------- | ----------------------------- | ------------------------- | -------------------------- | -------- | -> | CUDA_VERSION | CUDA backend | `cpu`, `12.6`, `12.8`, `13.0` | All | `cpu` (Apple Silicon) | `cpu` | -> | GPU_ARCH | Compute Capability | `80`, `90`, `native` | All | N/A | `native` | +| Platform | CUDA_VERSION Backend Support | Default | +|----------|----------------------------------|---------| +| Linux | `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | +| macOS | `cpu` | `cpu` | + +> **GPU_ARCH**: Specifies the GPU compute capability (e.g. `80`, `90`, `native`) when using CUDA backend on Linux. ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): From 2085591797033a92ceb813036773eb24103376ca Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 17:10:34 -0400 Subject: [PATCH 14/15] WIP --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a2c09e..158615b 100644 --- a/README.md +++ b/README.md @@ -67,12 +67,12 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: -| Platform | CUDA_VERSION Backend Support | Default | +| Platform | **CUDA_VERSION** Options| Default | |----------|----------------------------------|---------| | Linux | `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | | macOS | `cpu` | `cpu` | -> **GPU_ARCH**: Specifies the GPU compute capability (e.g. `80`, `90`, `native`) when using CUDA backend on Linux. +> **GPU_ARCH**: Specifies compute capability (e.g. `80`, `90`, `native`) for CUDA backend on Linux. ##### TGUF Conversion Scripts use [uv](https://docs.astral.sh/uv/): From 8041bedc7c8507257540f5615b28faef753bd267 Mon Sep 17 00:00:00 2001 From: Jacob-Chmura Date: Sun, 22 Mar 2026 17:12:52 -0400 Subject: [PATCH 15/15] WIP --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 158615b..c020d1e 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ If you prefer a bare-metal install: sudo apt-get install -y clang libc++-dev libc++abi-dev ``` -If you want to run with CUDA support, refer to [nvidia docs](https://developer.nvidia.com/cuda-12-6-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local) for installation steps. +If you want to run with CUDA, refer to [nvidia docs](https://developer.nvidia.com/cuda-12-6-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local) for nvidia toolkit installation. ##### MacOS @@ -67,10 +67,10 @@ brew install cmake libomp > \[!Important\] > **Platform Support**: -| Platform | **CUDA_VERSION** Options| Default | -|----------|----------------------------------|---------| -| Linux | `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | -| macOS | `cpu` | `cpu` | +| OS | **CUDA_VERSION** | Default | +| ----- | ----------------------------- | ------- | +| Linux | `cpu`, `12.6`, `12.8`, `13.0` | `cpu` | +| macOS | `cpu` | `cpu` | > **GPU_ARCH**: Specifies compute capability (e.g. `80`, `90`, `native`) for CUDA backend on Linux.