MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / copyFromHost

Function copyFromHost

extensions/include/cuMat/src/Matrix.h:826–837  ·  view source on GitHub ↗

* \brief Performs a synchronous copy from host data into the * device memory of this matrix. * This copy is synchronized on the default stream, * hence synchronous to every computation but slow. * \param data the data to copy into this matrix */

Source from the content-addressed store, hash-verified

824 * \param data the data to copy into this matrix
825 */
826 void copyFromHost(const _Scalar* data)
827 {
828 //slower, conservative: full synchronization
829 //CUMAT_SAFE_CALL(cudaMemcpy(data_.data(), data, sizeof(_Scalar)*size(), cudaMemcpyHostToDevice));
830 //CUMAT_SAFE_CALL(cudaDeviceSynchronize());
831
832 //faster: only synchronize this stream
833 CUMAT_SAFE_CALL(cudaMemcpyAsync(data_.data(), data, sizeof(_Scalar)*size(), cudaMemcpyHostToDevice, Context::current().stream()));
834 CUMAT_SAFE_CALL(cudaStreamSynchronize(Context::current().stream()));
835
836 CUMAT_PROFILING_INC(MemcpyHostToDevice);
837 }
838
839 /**
840 * \brief Performs a synchronous copy from the

Callers

nothing calls this directly

Calls 3

sizeFunction · 0.85
streamMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected