-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into BlockSparseArray_redesign_nested_slicing
- Loading branch information
Showing
16 changed files
with
147 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ Manifest.toml | |
.benchmarkci | ||
*.o | ||
*.swp | ||
*.swo | ||
*.cov | ||
benchmark/mult | ||
benchmark/*.json | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "NDTensors" | ||
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf" | ||
authors = ["Matthew Fishman <[email protected]>"] | ||
version = "0.3.32" | ||
version = "0.3.34" | ||
|
||
[deps] | ||
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" | ||
|
1 change: 1 addition & 0 deletions
1
NDTensors/ext/NDTensorsGPUArraysCoreExt/NDTensorsGPUArraysCoreExt.jl
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module NDTensorsGPUArraysCoreExt | ||
include("contract.jl") | ||
include("blocksparsetensor.jl") | ||
end |
26 changes: 26 additions & 0 deletions
26
NDTensors/ext/NDTensorsGPUArraysCoreExt/blocksparsetensor.jl
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,26 @@ | ||
using GPUArraysCore: @allowscalar, AbstractGPUArray | ||
using NDTensors: NDTensors, BlockSparseTensor, dense, diag, map_diag! | ||
using NDTensors.DiagonalArrays: diaglength | ||
using NDTensors.Expose: Exposed, unexpose | ||
|
||
## TODO to circumvent issues with blocksparse and scalar indexing | ||
## convert blocksparse GPU tensors to dense tensors and call diag | ||
## copying will probably have some impact on timing but this code | ||
## currently isn't used in the main code, just in tests. | ||
function NDTensors.diag(ETensor::Exposed{<:AbstractGPUArray,<:BlockSparseTensor}) | ||
return diag(dense(unexpose(ETensor))) | ||
end | ||
|
||
## TODO scalar indexing is slow here | ||
function NDTensors.map_diag!( | ||
f::Function, | ||
exposed_t_destination::Exposed{<:AbstractGPUArray,<:BlockSparseTensor}, | ||
exposed_t_source::Exposed{<:AbstractGPUArray,<:BlockSparseTensor}, | ||
) | ||
t_destination = unexpose(exposed_t_destination) | ||
t_source = unexpose(exposed_t_source) | ||
@allowscalar for i in 1:diaglength(t_destination) | ||
NDTensors.setdiagindex!(t_destination, f(NDTensors.getdiagindex(t_source, i)), i) | ||
end | ||
return t_destination | ||
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
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
Oops, something went wrong.