Skip to content

Commit 9f450a0

Browse files
authored
fix: local JLL build script (#108)
1 parent fa10aa0 commit 9f450a0

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

deps/build_local.jl

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Invoke with
2-
# `julia --project=deps deps/build_local.jl [path-to-enzyme]`
2+
# `julia --project=deps deps/build_local.jl [dbg/opt]`
33

44
# the pre-built ReactantExtra_jll might not be loadable on this platform
55
Reactant_jll = Base.UUID("0192cb87-2b54-54ad-80e0-3be72ad8a3c0")
@@ -24,7 +24,6 @@ run(Cmd(`$(Base.julia_cmd().exec[1]) --project=. -e "using Pkg; Pkg.instantiate(
2424
#--define=using_rocm=true --define=using_rocm_hipcc=true
2525
#--action_env TF_ROCM_AMDGPU_TARGETS="gfx900,gfx906,gfx908,gfx90a,gfx1030"
2626

27-
2827
# --repo_env TF_NEED_CUDA=1
2928
# --repo_env TF_NVCC_CLANG=1
3029
# --repo_env TF_NCCL_USE_STUB=1
@@ -38,16 +37,35 @@ run(Cmd(`$(Base.julia_cmd().exec[1]) --project=. -e "using Pkg; Pkg.instantiate(
3837
# --crosstool_top="@local_config_cuda//crosstool:toolchain"
3938

4039
arg = try
41-
run(Cmd(`nvidia-smi`))
42-
"--config=cuda"
40+
run(Cmd(`nvidia-smi`))
41+
"--config=cuda"
4342
catch
44-
""
43+
""
44+
end
45+
46+
build_kind = if length(ARGS) == 1
47+
kind = ARGS[1]
48+
if kind ("dbg", "opt")
49+
error("Invalid build kind $(kind). Valid options are 'dbg' and 'opt'")
50+
end
51+
kind
52+
else
53+
"dbg"
4554
end
4655

47-
run(Cmd(`bazel build $(arg) -c dbg --action_env=JULIA=$(Base.julia_cmd().exec[1])
48-
--repo_env HERMETIC_PYTHON_VERSION="3.10"
49-
--check_visibility=false --verbose_failures :libReactantExtra.so :Builtin.inc.jl :Arith.inc.jl :Affine.inc.jl :Func.inc.jl :Enzyme.inc.jl :StableHLO.inc.jl :CHLO.inc.jl :VHLO.inc.jl`, dir=source_dir,
50-
))
56+
@info "Building JLL with -c $(build_kind)"
57+
58+
if isempty(arg)
59+
run(Cmd(`bazel build -c $(build_kind) --action_env=JULIA=$(Base.julia_cmd().exec[1])
60+
--repo_env HERMETIC_PYTHON_VERSION="3.10"
61+
--check_visibility=false --verbose_failures :libReactantExtra.so :Builtin.inc.jl :Arith.inc.jl :Affine.inc.jl :Func.inc.jl :Enzyme.inc.jl :StableHLO.inc.jl :CHLO.inc.jl :VHLO.inc.jl`, dir=source_dir,
62+
))
63+
else
64+
run(Cmd(`bazel build $(arg) -c $(build_kind) --action_env=JULIA=$(Base.julia_cmd().exec[1])
65+
--repo_env HERMETIC_PYTHON_VERSION="3.10"
66+
--check_visibility=false --verbose_failures :libReactantExtra.so :Builtin.inc.jl :Arith.inc.jl :Affine.inc.jl :Func.inc.jl :Enzyme.inc.jl :StableHLO.inc.jl :CHLO.inc.jl :VHLO.inc.jl`, dir=source_dir,
67+
))
68+
end
5169
# env=Dict("HOME"=>ENV["HOME"], "PATH"=>joinpath(source_dir, "..")*":"*ENV["PATH"])))
5270

5371
run(Cmd(`rm -f libReactantExtra.dylib`, dir=joinpath(source_dir, "bazel-bin")))

0 commit comments

Comments
 (0)