Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Needs["OpenCLLink`"]
- srcf = FileNameJoin[{$OpenCLLinkPath, "SupportFiles", "matrixMul.cl"}]
- blockSize = 4;
- MatrixMultiply = OpenCLFunctionLoad[File[srcf],
- "matrixMul", {{"Float", 2, "Output"}, {"Float", 2,
- "Input"}, {"Float", 2, "Input"}, {"Local", "Float"}, {"Local",
- "Float"}, _Integer, _Integer}, {blockSize, blockSize},
- "Defines" -> {"BLOCK_SIZE" -> blockSize}]
- A = RandomChoice[{0, 1}, {8, 8}];
- B = RandomChoice[{0, 1}, {8, 8}];
- out = OpenCLMemoryAllocate["Float", {8, 8}]
- MatrixMultiply[out, A, B, blockSize*blockSize, blockSize*blockSize,8,8]
Add Comment
Please, Sign In to add comment