/** * Allocates the {@link GPUObject} for a given LOPS Variable (eg. _mVar3) * * @param varName variable name * @return matrix object * @throws DMLRuntimeException if DMLRuntimeException occurs */ public MatrixObject allocateGPUMatrixObject(String varName) throws DMLRuntimeException { MatrixObject mo = getMatrixObject(varName); if (mo.getGPUObject() == null) { mo.setGPUObject(GPUContext.createGPUObject(mo)); } return mo; }
public MatrixObject getMatrixInputForGPUInstruction(String varName) throws DMLRuntimeException { MatrixObject mo = getMatrixObject(varName); if (mo == null) { throw new DMLRuntimeException("No matrix object available for variable:" + varName); } if (mo.getGPUObject() == null) { mo.setGPUObject(GPUContext.createGPUObject(mo)); } boolean acquired = false; if (!mo.getGPUObject().isAllocated()) { mo.acquireRead(); acquired = true; } mo.getGPUObject().acquireDeviceRead(); if (acquired) { mo.release(); } return mo; }