-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31207e1
commit f5111df
Showing
6 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
module JACCPreferences | ||
|
||
using Preferences | ||
|
||
# taken from https://github.com/JuliaPackaging/Preferences.jl | ||
function set_backend(new_backend::String) | ||
|
||
new_backend_lc = lowercase(new_backend) | ||
if !(new_backend_lc in ("threads", "cuda", "amdgpu", "oneapi")) | ||
throw(ArgumentError("Invalid backend: \"$(new_backend)\"")) | ||
end | ||
|
||
# Set it in our runtime values, as well as saving it to disk | ||
@set_preferences!("backend" => new_backend_lc) | ||
@info("New backend set; restart your Julia session for this change to take effect!") | ||
end | ||
|
||
const backend = @load_preference("backend", "threads") | ||
|
||
|
||
end # module JACCPreferences |