-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from DrChainsaw/cudaext
Make CUDA a weakdep
- Loading branch information
Showing
17 changed files
with
142 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module NaiveGAfluxCUDAExt | ||
|
||
using NaiveGAflux | ||
import CUDA | ||
|
||
struct NaiveGAfluxCudaDevice{D} | ||
device::D | ||
end | ||
|
||
# Doesn't seem like we can do much with the device we got from CUDA, but lets keep it in case someone finds a use for it | ||
NaiveGAflux.execution_device(a::CUDA.CuArray) = NaiveGAfluxCudaDevice(CUDA.device(a)) | ||
|
||
function NaiveGAflux._availablebytes(::NaiveGAfluxCudaDevice) | ||
# Doesn't seem like CUDA exposes these per device | ||
info = CUDA.MemoryInfo() | ||
info.free_bytes + info.pool_reserved_bytes - info.pool_used_bytes | ||
end | ||
|
||
# Should map data to device, but how? | ||
NaiveGAflux.matchdatatype(::NaiveGAfluxCudaDevice, iter) = GpuIterator(iter) | ||
|
||
NaiveGAflux._rangetoarr(a::Type{<:CUDA.CuArray}) = a | ||
|
||
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
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,19 @@ | ||
using PrecompileTools | ||
|
||
@setup_workload begin | ||
@compile_workload begin | ||
## This depends on RNG Implementation which is probably not ideal... | ||
Logging.with_logger(Logging.NullLogger()) do | ||
AutoFlux.fit( | ||
AutoFlux.ImageClassification.ImageClassifier(; | ||
popsize=2, | ||
insize=(32,32,3,0), | ||
outsize=10 | ||
), | ||
zeros(Float32, 32,32,3,0), # Zero size so we at least don't compute and gradients and stuff | ||
zeros(Int, 10, 0); | ||
stopcriterion = pop -> generation(pop) > 1) | ||
end | ||
end | ||
Random.seed!(rng_default, 1) | ||
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
Oops, something went wrong.