* \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 */
| 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 |