test: check DSpark device usage before skipping

This commit is contained in:
Constantin committed 2026-11-03 14:35:30 -05:00
1 parent c1c8e40445
commit 8088c9a783
1 file changed
+2 -1
+2 -1
View File
@@ -216,9 +216,10 @@ static void checkpoint_head(Fn head, Fn walk, const char* weights_path) {
}
int main(int argc,char** argv) {
check(argc==2 || (argc==4 && !std::strcmp(argv[2],"--head-weights")),"usage: dspark_device_test libr4d.so [--head-weights file]");
int n_devices = 0;
if (hipGetDeviceCount(&n_devices) != hipSuccess || n_devices == 0) return 77;
check(argc==2 || (argc==4 && !std::strcmp(argv[2],"--head-weights")),"usage: dspark_device_test libr4d.so [--head-weights file]"); void* h=dlopen(argv[1],RTLD_NOW|RTLD_LOCAL);
void* h=dlopen(argv[1],RTLD_NOW|RTLD_LOCAL);
if(!h) { std::fprintf(stderr,"dlopen: %s\n",dlerror()); return 1; }
Fn fn=symbol(h,"r4d_rad_dflash_markov_greedy");
Fn fn_f32=symbol(h,"r4d_rad_dflash_markov_greedy_f32");