Skip to content

Commit 74c90bf

Browse files
authored
Remove unnecessary dependencies and allow using external installs (#1321)
* Remove unnecessary dependencies and allow using external installs * Cleanup before PR and format * Add FindNCCL from torch, remove unnecessary cmake files * Cleanup nccl cmake * Fix remaining optional bugs in kernels * Try nix-based CI * Fix nix-develop version * Fix flake devshell name * Move ci build code to script * Satisfy shellcheck * Try removing ccache * Attempt to skip ccache install * Move to using in-flake caches * Format
1 parent 3237169 commit 74c90bf

File tree

94 files changed

+1130
-789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1130
-789
lines changed

.flake/pkgs/legion.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{ lib
2+
, stdenv
3+
, fetchFromGitLab
4+
, cmake
5+
, python3
6+
, cudaPackages ? { }
7+
, cudaCapabilities ? [ "60" "70" "80" "86" ]
8+
, maxDim ? 5
9+
}:
10+
11+
# from https://codeberg.org/Uli/nix-things/src/commit/776519e382c81b136c1d0b10d8c7b52b4acb9192/overlays/cq/python/libclang-python.nix
12+
13+
let
14+
cmakeFlag = x: if x then "1" else "0";
15+
16+
inherit (cudaPackages) cudatoolkit;
17+
in
18+
19+
stdenv.mkDerivation rec {
20+
pname = "legion_flexflow";
21+
version = "2024-03-13";
22+
23+
src = fetchFromGitLab {
24+
owner = "StanfordLegion";
25+
repo = "legion";
26+
rev = "24e8c452341dea41427e0ce61e154d61715e6835";
27+
sha256 = "sha256-NjCSjphOIew/V24i74I6DModSGcWKLeiSIjts3cFtx4=";
28+
fetchSubmodules = true;
29+
};
30+
31+
nativeBuildInputs = [
32+
cmake
33+
];
34+
35+
cmakeFlags = [
36+
"-DLegion_USE_Python=1"
37+
"-DLegion_BUILD_BINDINGS=1"
38+
"-DLegion_USE_CUDA=1"
39+
"-DLegion_CUDA_ARCH=${lib.concatStringsSep "," cudaCapabilities}"
40+
"-DLegion_MAX_DIM=${toString maxDim}"
41+
];
42+
43+
buildInputs = [
44+
python3
45+
cudatoolkit
46+
];
47+
48+
meta = with lib; {
49+
description = "Legion is a parallel programming model for distributed, heterogeneous machines";
50+
homepage = "https://github.com/StanfordLegion/legion";
51+
license = licenses.asl20;
52+
};
53+
}

.flake/pkgs/tokenizers-cpp.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{ lib
2+
, stdenv
3+
, fetchFromGitHub
4+
, cmake
5+
, rustc
6+
, cargo
7+
}:
8+
9+
stdenv.mkDerivation rec {
10+
pname = "tokenizers-cpp";
11+
version = "2024-03-13";
12+
13+
src = fetchFromGitHub {
14+
owner = "mlc-ai";
15+
repo = "tokenizers-cpp";
16+
rev = "4f42c9fa74946d70af86671a3804b6f2433e5dac";
17+
sha256 = "sha256-p7OYx9RVnKUAuMexy3WjW2zyfMJ/Q9ss4xFLsbQK7wA=";
18+
fetchSubmodules = true;
19+
};
20+
21+
nativeBuildInputs = [
22+
cmake
23+
rustc
24+
];
25+
26+
# cmakeFlags = [
27+
# "-DLegion_USE_Python=1"
28+
# "-DLegion_BUILD_BINDINGS=1"
29+
# "-DLegion_USE_CUDA=1"
30+
# "-DLegion_CUDA_ARCH=${lib.concatStringsSep "," cudaCapabilities}"
31+
# ];
32+
33+
buildInputs = [ ];
34+
# python3
35+
# cudatoolkit
36+
# ];
37+
38+
meta = with lib; {
39+
description = "Universal cross-platform tokenizers binding to HF and sentencepiece";
40+
homepage = "https://github.com/mlc-ai/tokenizers-cpp";
41+
license = licenses.asl20;
42+
};
43+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#! /usr/bin/env bash
2+
3+
set -euo pipefail
4+
set -x
5+
6+
DIR="$(realpath -- "$(dirname "${BASH_SOURCE[0]}")")"
7+
REPO="$(realpath -- "$DIR/../../../")"
8+
9+
export FF_GPU_BACKEND="cuda"
10+
export FF_CUDA_ARCH=70
11+
cd "$REPO"
12+
mkdir build
13+
cd build
14+
#if [[ "${FF_GPU_BACKEND}" == "cuda" ]]; then
15+
# export FF_BUILD_ALL_EXAMPLES=ON
16+
# export FF_BUILD_UNIT_TESTS=ON
17+
#fi
18+
../config/config.linux \
19+
-DCMAKE_CXX_COMPILER="clang++" \
20+
-DCMAKE_C_COMPILER="clang" \
21+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
22+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
23+
-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
24+
-DFF_USE_EXTERNAL_LEGION=ON \
25+
-DFF_USE_EXTERNAL_JSON=ON \
26+
-DFF_USE_EXTERNAL_FMT=ON \
27+
-DFF_USE_EXTERNAL_SPDLOG=ON
28+
29+
# vim: set tabstop=2 shiftwidth=2 expandtab:

.github/workflows/per-lib-check.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ jobs:
88
cmake-build:
99
name: Library CMake Build
1010
runs-on: ubuntu-20.04
11-
defaults:
12-
run:
13-
shell: bash -l {0} # required to use an activated conda environment
11+
1412
strategy:
1513
max-parallel: 1
1614
matrix:
@@ -22,23 +20,27 @@ jobs:
2220
with:
2321
submodules: recursive
2422

25-
- name: Free additional space on runner
26-
run: .github/workflows/helpers/free_space_on_runner.sh
23+
- name: Install nix
24+
uses: cachix/install-nix-action@v25
25+
with:
26+
github_access_token: '${{ secrets.GITHUB_TOKEN }}'
2727

28-
- name: Install CUDA
29-
uses: Jimver/[email protected]
30-
id: cuda-toolkit
28+
- uses: cachix/cachix-action@v14
3129
with:
32-
cuda: "12.1.0"
33-
# Disable caching of the CUDA binaries, since it does not give us any significant performance improvement
34-
use-github-cache: "false"
35-
linux-local-args: '["--toolkit"]'
30+
name: ff
31+
skipPush: true
32+
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
33+
34+
- name: setup nix develop shell
35+
uses: nicknovitski/[email protected]
36+
with:
37+
arguments: "--accept-flake-config .#ci"
3638

3739
- name: ccache
3840
uses: hendrikmuhs/[email protected]
3941

40-
- name: Install system dependencies
41-
run: FF_GPU_BACKEND=${{ matrix.gpu_backend }} .github/workflows/helpers/install_dependencies.sh
42+
# - name: Install system dependencies
43+
# run: FF_GPU_BACKEND=${{ matrix.gpu_backend }} .github/workflows/helpers/install_dependencies.sh
4244

4345
# - name: Install conda and FlexFlow dependencies
4446
# uses: conda-incubator/setup-miniconda@v2
@@ -49,20 +51,7 @@ jobs:
4951

5052
- name: Run cmake
5153
run: |
52-
export CUDNN_DIR=/usr/local/cuda
53-
export CUDA_DIR=/usr/local/cuda
54-
export FF_HOME=$(pwd)
55-
export FF_GPU_BACKEND=${{ matrix.gpu_backend }}
56-
export FF_CUDA_ARCH=70
57-
n_build_cores=$(( $(nproc) cores_available -1 ))
58-
if (( $n_build_cores < 1 )) ; then n_build_cores=1 ; fi
59-
mkdir build
60-
cd build
61-
#if [[ "${FF_GPU_BACKEND}" == "cuda" ]]; then
62-
# export FF_BUILD_ALL_EXAMPLES=ON
63-
# export FF_BUILD_UNIT_TESTS=ON
64-
#fi
65-
../config/config.linux -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache
54+
.github/workflows/helpers/build_${{ matrix.gpu_backend }}.sh
6655
6756
- name: Build utils
6857
run: |

.gitmodules

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,6 @@
44
[submodule "deps/nccl"]
55
path = deps/nccl
66
url = https://github.com/NVIDIA/nccl.git
7-
[submodule "deps/pybind11"]
8-
path = deps/pybind11
9-
url = https://github.com/pybind/pybind11.git
10-
[submodule "deps/googletest"]
11-
path = deps/googletest
12-
url = https://github.com/google/googletest.git
13-
[submodule "deps/variant"]
14-
path = deps/variant
15-
url = https://github.com/mpark/variant
16-
[submodule "deps/optional"]
17-
path = deps/optional
18-
url = https://github.com/TartanLlama/optional.git
197
[submodule "deps/json"]
208
path = deps/json
219
url = https://github.com/nlohmann/json.git
@@ -37,9 +25,3 @@
3725
[submodule "deps/fmt"]
3826
path = deps/fmt
3927
url = https://github.com/fmtlib/fmt.git
40-
[submodule "deps/invoke"]
41-
path = deps/invoke
42-
url = https://github.com/BlackMATov/invoke.hpp.git
43-
[submodule "deps/any"]
44-
path = deps/any
45-
url = https://github.com/thelink2012/any.git

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
cmake_minimum_required(VERSION 3.10)
22
project(FlexFlow)
33

4-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/cmake)
4+
set(
5+
CMAKE_MODULE_PATH
6+
${CMAKE_MODULE_PATH}
7+
${CMAKE_CURRENT_LIST_DIR}/cmake
8+
${CMAKE_CURRENT_LIST_DIR}/cmake/Modules
9+
)
510

611
# Detect OS type and Linux version (if it applies)
712
set(LINUX_VERSION "")
@@ -28,7 +33,7 @@ set(FF_MAX_NUM_TASK_REGIONS "20" CACHE STRING
2833
set(FF_MAX_NUM_TASK_ARGUMENTS "5" CACHE STRING
2934
"Maximum number of arguments that can be declared in a TaskSignature")
3035
option(FF_USE_NCCL "Run FlexFlow with NCCL" OFF)
31-
option(FF_USE_PREBUILT_NCCL "Enable use of NCCL pre-compiled library, if available" ON)
36+
option(FF_USE_EXTERNAL_NCCL "Enable use of NCCL pre-compiled library, if available" ON)
3237
option(FF_USE_PREBUILT_LEGION "Enable use of Legion pre-compiled library, if available" ON)
3338
option(FF_USE_ALL_PREBUILT_LIBRARIES "Enable use of all pre-compiled libraries, if available" OFF)
3439
option(FF_USE_PYTHON "Enable Python" ON)
@@ -77,20 +82,15 @@ include(nccl)
7782
# set_property(CACHE FF_GPU_BACKEND PROPERTY STRINGS ${FF_GPU_BACKENDS})
7883

7984
include(json)
80-
include(optional)
8185
include(expected)
8286
include(spdlog)
83-
include(variant)
8487
include(doctest)
8588
include(visit_struct)
8689
include(CTest)
8790
include(fmt)
8891
include(legion)
8992
include(rapidcheck)
90-
include(invoke)
91-
include(any)
9293
#include(gtest)
93-
#include(fmt)
9494

9595
include(flexflow-utils)
9696

0 commit comments

Comments
 (0)