okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b0fc432ed
main
1// Standalone run of the engine's kernel self-test (src/selftest.cu) on one card: no model, no engine. Built by the optional CMake target strata-split-selftest 2// (src/split/CMakeLists.txt; HIP only, off by default). Prints the card and the result; exit 0 when every test passed. 3// selftest_main [device] 4#include <hip/hip_runtime.h> 5 6#include <chrono> 7#include <cstdio> 8#include <cstdlib> 9#include <string> 10 11#include "../src/selftest.hpp" 12 13int main (int argc ,char ** argv ) { 14const int dev = argc > 1 ? std::atoi (argv [1 ]) :0 ; 15hipDeviceProp_t p ; 16if (hipGetDeviceProperties (& p ,dev )!= hipSuccess ) { 17 std::printf ("no device %d\n" ,dev ); 18return 2 ; 19 } 20 std::printf ("device %d: %s (%s), %d CUs, %.1f GiB\n" ,dev ,p .name ,p .gcnArchName ,p .multiProcessorCount , (double )p .totalGlobalMem / (1 <<30 )); 21 std::string covered ; 22const auto t0 = std::chrono::steady_clock::now (); 23const std::string bad = fnx::selftest_card (dev ,covered ); 24const double ms = std::chrono::duration < double , std::milli > (std::chrono::steady_clock::now ()- t0 ).count (); 25if (bad .empty ()) std::printf ("self-test PASSED in %.0f ms: %s\n" ,ms ,covered .c_str ()); 26else std::printf ("self-test FAILED in %.0f ms: %s\n" ,ms ,bad .c_str ()); 27return bad .empty () ?0 :1 ; 28}