-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* all major changes * authors + deps * machine agnostic * Fix for tensor on GPU * machine agnostic reduction * proper reduction * syntax * Log repartition + support for Old 2d FNO --------- Co-authored-by: turquoisedragon2926 <rarockiasamy3@gatech.edu> Co-authored-by: Rex Arockiasamy <rarockiasamy3@cos-4a10678.cos.gatech.edu>
- Loading branch information
1 parent
4e90ece
commit 47b8cee
Showing
14 changed files
with
394 additions
and
25 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
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,47 @@ | ||
export ParReduce | ||
|
||
""" | ||
Reduction Operator. Reduce across the given communicator | ||
""" | ||
struct ParReduce{T} <: ParOperator{T,T,Linear,NonParametric,External} | ||
comm::MPI.Comm | ||
|
||
ParReduce() = new{Float64}(MPI.COMM_WORLD) | ||
ParReduce(T::DataType) = new{T}(MPI.COMM_WORLD) | ||
ParReduce(T::DataType, comm::MPI.Comm) = new{T}(comm) | ||
ParReduce(comm::MPI.Comm) = new{Float64}(comm) | ||
end | ||
|
||
function (A::ParReduce{T})(x::X) where {T,X<:AbstractVector{T}} | ||
device = get_device(x) | ||
if device == "cpu" | ||
return MPI.Allreduce(x, MPI.SUM, A.comm) | ||
elseif device == "gpu" | ||
return MPI.Allreduce(x |> cpu, MPI.SUM, A.comm) |> gpu | ||
end | ||
end | ||
|
||
function (A::ParReduce{T})(x::X) where {T,X<:AbstractArray{T}} | ||
device = get_device(x) | ||
if device == "cpu" | ||
return MPI.Allreduce(x, MPI.SUM, A.comm) | ||
elseif device == "gpu" | ||
return MPI.Allreduce(x |> cpu, MPI.SUM, A.comm) |> gpu | ||
end | ||
end | ||
|
||
function ChainRulesCore.rrule(A::ParReduce{T}, x::X) where {T,X<:AbstractVector{T}} | ||
op_out = A(x) | ||
function pullback(op) | ||
return NoTangent(), op | ||
end | ||
return op_out, pullback | ||
end | ||
|
||
function ChainRulesCore.rrule(A::ParReduce{T}, x::X) where {T,X<:AbstractArray{T}} | ||
op_out = A(x) | ||
function pullback(op) | ||
return NoTangent(), op | ||
end | ||
return op_out, pullback | ||
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.