-
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.
- Loading branch information
Showing
2 changed files
with
13 additions
and
10 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 |
---|---|---|
@@ -1,31 +1,34 @@ | ||
module ITensorGPU | ||
using CUDA: CUDA | ||
using ITensors: cpu, cu | ||
export cpu, cu | ||
using Adapt: adapt | ||
using CUDA: CUDA, cu | ||
export cu | ||
using ITensors: cpu | ||
export cpu | ||
|
||
using ITensors: ITensor, cpu, cu, randomITensor | ||
function cuITensor(args...; kwargs...) | ||
return cu(ITensor(args...; kwargs...)) | ||
return adapt(CuArray, ITensor(args...; kwargs...)) | ||
end | ||
function randomCuITensor(args...; kwargs...) | ||
return cu(randomITensor(args...; kwargs...)) | ||
return adapt(CuArray, randomITensor(args...; kwargs...)) | ||
end | ||
export cuITensor, randomCuITensor | ||
|
||
# TODO: Change over to `using ITensorMPS` | ||
# once it is registered. | ||
using ITensors.ITensorMPS: MPO, MPS, randomMPS | ||
function cuMPS(args...; kwargs...) | ||
return cu(MPS(args...; kwargs...)) | ||
return adapt(CuArray, MPS(args...; kwargs...)) | ||
end | ||
function productCuMPS(args...; kwargs...) | ||
return cu(MPS(args...; kwargs...)) | ||
return adapt(CuArray, MPS(args...; kwargs...)) | ||
end | ||
function randomCuMPS(args...; kwargs...) | ||
return cu(randomMPS(args...; kwargs...)) | ||
return adapt(CuArray, randomMPS(args...; kwargs...)) | ||
end | ||
function cuMPO(args...; kwargs...) | ||
return cu(MPO(args...; kwargs...)) | ||
return adapt(CuArray, MPO(args...; kwargs...)) | ||
end | ||
cuMPO(tn::MPO) = cu(tn) | ||
export cuMPO, cuMPS, productCuMPS, randomCuMPO, randomCuMPS | ||
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