Skip to content

Commit

Permalink
Support XLA_ARCHIVE_PATH (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko authored Nov 7, 2024
1 parent a8c95b5 commit 1623541
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Building has a number of dependencies, see *Building from source* below.
A URL pointing to a specific build of the `.tar.gz` archive. When using this option
you need to make sure the build matches your OS, CPU architecture and the XLA target.

#### `XLA_ARCHIVE_PATH`

Just like `XLA_ARCHIVE_URL`, but pointing to a local `.tar.gz` archive file.

#### `XLA_CACHE_DIR`

The directory to store the downloaded and built archives in. Defaults to the standard
Expand Down
7 changes: 7 additions & 0 deletions lib/xla.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ defmodule XLA do
# The archive should have already been built by this point
archive_path_for_build()

path = xla_archive_path() ->
path

url = xla_archive_url() ->
path = archive_path_for_external_download(url)
unless File.exists?(path), do: download_external!(url, path)
Expand All @@ -56,6 +59,10 @@ defmodule XLA do
System.get_env("XLA_BUILD") in ~w(1 true)
end

defp xla_archive_path() do
System.get_env("XLA_ARCHIVE_PATH")
end

defp xla_archive_url() do
System.get_env("XLA_ARCHIVE_URL")
end
Expand Down

0 comments on commit 1623541

Please sign in to comment.