* \brief Checks if the underlying data is used by an other matrix expression and if so, * copies the data so that this matrix is the exclusive user of that data. * * This method has no effect if \ref isExclusiveUse is already true. * * Postcondition: isExclusiveUse() == true */
| 757 | * Postcondition: <code>isExclusiveUse() == true</code> |
| 758 | */ |
| 759 | void makeExclusiveUse() |
| 760 | { |
| 761 | if (isExclusiveUse()) return; |
| 762 | |
| 763 | DevicePointer<_Scalar> ptr = data_.dataPointer(); |
| 764 | data_ = Storage_t(rows(), cols(), batches()); |
| 765 | CUMAT_SAFE_CALL(cudaMemcpyAsync(data(), ptr.pointer(), sizeof(_Scalar)*rows()*cols()*batches(), cudaMemcpyDeviceToDevice, Context::current().stream())); |
| 766 | CUMAT_PROFILING_INC(MemcpyDeviceToDevice); |
| 767 | |
| 768 | assert(isExclusiveUse()); |
| 769 | } |
| 770 | |
| 771 | // COPY CALLS |
| 772 |