-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
6 changed files
with
115 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module KernelAbstractionsExt | ||
|
||
import Thermodynamics.Utils as Util | ||
import KernelAbstractions as KA | ||
|
||
Util.ka_print(args...) = KA.@print(args...) | ||
|
||
end |
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,23 @@ | ||
module Utils | ||
|
||
import Thermodynamics | ||
|
||
""" | ||
print_(args...) | ||
Print whatever is in `args`. Compatible with both CPU and GPU. | ||
If CUDA is not loaded, then KernelAbstractions is not loaded which means | ||
`Base.print` is called. If CUDA is loaded, then KernelAbstractions is loaded and | ||
`KernelAbstractions.@print` is called. | ||
""" | ||
function print_(args...) | ||
if !isnothing(Base.get_extension(Thermodynamics, :KernelAbstractionsExt)) | ||
return ka_print(args...) | ||
end | ||
return Base.print(args...) | ||
end | ||
|
||
function ka_print end | ||
|
||
end |
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