public MyMatrixAutoOps(MyWorkingNode callee, MatOperation operations, MyMemoryBlock<float> A = null) { if ((MyMatrixKernelOps.AvailableOperations() & operations) > 0) { MatKerlOps = new MyMatrixKernelOps(callee, operations); } if ((MyMatrixCublasOps.AvailableOperations() & operations) > 0) { MatCublOps = new MyMatrixCublasOps(callee); } if ((MyMatrixCPUOps.AvailableOperations() & operations) > 0) { MatCPUOps = new MyMatrixCPUOps(callee); } }
public MyMatrixAutoOps(MyWorkingNode callee, MatOperation operations, MyMemoryBlock <float> A = null) { if ((MyMatrixKernelOps.AvailableOperations() & operations) > 0) { MatKerlOps = new MyMatrixKernelOps(callee, operations); } if ((MyMatrixCublasOps.AvailableOperations() & operations) > 0) { MatCublOps = new MyMatrixCublasOps(callee); } if ((MyMatrixCPUOps.AvailableOperations() & operations) > 0) { MatCPUOps = new MyMatrixCPUOps(callee); } }
public override void Run(MatOperation operation, MyMemoryBlock <float> A, MyMemoryBlock <float> Result) { if ((MyMatrixCublasOps.AvailableOperations() & operation) > 0) { MatCublOps.Run(operation, A, Result); } else if ((MyMatrixKernelOps.AvailableOperations() & operation) > 0) { MatKerlOps.Run(operation, A, Result); } else { MyLog.Writer.WriteLine(MyLogLevel.ERROR, "Trying to run undefined MatOps"); } }
/// <summary> /// Enables overriding the dimensions to be applicable on tensors. Result columnHint seems not to be used for any operation so there is no need to override it. /// </summary> /// <param name="operation"></param> /// <param name="A"></param> /// <param name="Result"></param> /// <param name="AColumnHint">sees A as a matrix with this number of columns</param> public override void Run(MatOperation operation, MyMemoryBlock <float> A, MyMemoryBlock <float> Result, int AColumnHint) { if (A.Count % AColumnHint != 0) { throw new ArgumentException(string.Format("MyMatrixAutoOps: number of matrix elements ({0}) is not divisible by the desired column hint ({1})", A.Count, AColumnHint)); } if ((MyMatrixCublasOps.AvailableOperations() & operation) > 0) { MatCublOps.Run(operation, A, Result, AColumnHint); } else if ((MyMatrixKernelOps.AvailableOperations() & operation) > 0) { MatKerlOps.Run(operation, A, Result, AColumnHint); } else { MyLog.Writer.WriteLine(MyLogLevel.ERROR, "Trying to run undefined MatOps"); } }