Skip to content

Commit 0b58bd3

Browse files
committed
Improved memcpy-host* versatility.
1 parent 5c0d8db commit 0b58bd3

File tree

1 file changed

+14
-14
lines changed
  • src/clojure/uncomplicate/clojurecuda/internal

1 file changed

+14
-14
lines changed

src/clojure/uncomplicate/clojurecuda/internal/impl.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,13 @@
758758
(put-entry! pp i haddr))
759759
Memcpy
760760
(memcpy-host* [this src byte-count]
761-
(if (and (satisfies? CUPointer src) (device? src))
761+
(if (device? src)
762762
(with-check (cudart/cuMemcpy (get-entry haddr 0) (cu-address* src) byte-count) this)
763763
(cpp/memcpy! (safe (pointer src)) (extract hptr)))
764764
this)
765765
(memcpy-host* [this src byte-count hstream]
766766
(with-check
767-
(if (and (satisfies? CUPointer src) (device? src))
767+
(if (device? src)
768768
(cudart/cuMemcpyAsync (get-entry haddr 0) (cu-address* src) byte-count hstream)
769769
(cudart/cuMemcpyHtoDAsync (get-entry haddr 0) (safe (pointer src)) byte-count hstream))
770770
this))
@@ -806,30 +806,30 @@
806806
(memcpy-host*
807807
([this src byte-count]
808808
(with-check
809-
(if (and (satisfies? CUPointer src) (device? src))
810-
(cudart/cuMemcpyDtoH (extract this) (cu-address* src) byte-count)
811-
(cudart/cudaMemcpy (extract this) (safe (pointer src)) cudart/cudaMemcpyDefault byte-count))
809+
(if (instance? Pointer src)
810+
(cudart/cudaMemcpy (extract this) (safe (pointer src)) cudart/cudaMemcpyDefault byte-count)
811+
(cudart/cuMemcpyDtoH (extract this) (cu-address* src) byte-count))
812812
this))
813813
([this src byte-count hstream]
814814
(with-check
815-
(if (and (satisfies? CUPointer src) (device? src))
816-
(cudart/cuMemcpyDtoHAsync (extract this) (cu-address* src) byte-count hstream)
815+
(if (instance? Pointer src)
817816
(cudart/cudaMemcpyAsync (extract this) (safe (pointer src))
818-
cudart/cudaMemcpyDefault byte-count hstream))
817+
cudart/cudaMemcpyDefault byte-count hstream)
818+
(cudart/cuMemcpyDtoHAsync (extract this) (cu-address* src) byte-count hstream))
819819
this)))
820820
(memcpy*
821821
([this src byte-count]
822822
(with-check
823-
(if (satisfies? CUPointer src)
824-
(cudart/cuMemcpy (address (extract this)) (cu-address* src) byte-count)
825-
(cudart/cudaMemcpy (extract this) (safe (pointer src)) byte-count cudart/cudaMemcpyDefault))
823+
(if (instance? Pointer src)
824+
(cudart/cudaMemcpy (extract this) (safe (pointer src)) byte-count cudart/cudaMemcpyDefault)
825+
(cudart/cuMemcpy (address (extract this)) (cu-address* src) byte-count))
826826
this))
827827
([this src byte-count hstream]
828828
(with-check
829-
(if (satisfies? CUPointer src)
830-
(cudart/cuMemcpyAsync (address (extract this)) (cu-address* src) byte-count hstream)
829+
(if (instance? Pointer src)
831830
(cudart/cudaMemcpyAsync (extract this) (safe (pointer src))
832-
byte-count cudart/cudaMemcpyDefault hstream))
831+
byte-count cudart/cudaMemcpyDefault hstream)
832+
(cudart/cuMemcpyAsync (address (extract this)) (cu-address* src) byte-count hstream))
833833
this))))
834834

835835
;; ================== Stream Management ======================================

0 commit comments

Comments
 (0)