MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / main

Function main

examples/transpose/run.cpp:210–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210int main() {
211 char* version_str = getenv("TEST_VERSION");
212 int version = version_str == NULL ? 2 : atoi(version_str);
213 // 0 == cpu
214 // 1 == naive transpose
215 // 2 == tiling with shared memory
216
217 size_t M, N; // Matrix dimensions
218 static constexpr int kTestSize = 2;
219 if constexpr (kTestSize == 0) {
220 // Tiny test
221 M = 16;
222 N = 32;
223 } else if constexpr (kTestSize == 1) {
224 // Small test
225 M = 256;
226 N = 512;
227 } else {
228 // Large test
229 M = 4096;
230 N = 2 * 4096;
231 }
232
233 std::unique_ptr<float[]> inputPtr = std::make_unique<float[]>(M * N);
234 std::unique_ptr<float[]> outputPtr = std::make_unique<float[]>(N * M);
235
236 initData(M, N, inputPtr);
237 runTest(version, M, N, inputPtr, outputPtr);
238
239 LOG(kDefLog, kInfo, "Done.");
240 return 0;
241}

Callers

nothing calls this directly

Calls 3

LOGFunction · 0.85
initDataFunction · 0.70
runTestFunction · 0.70

Tested by

no test coverage detected