the card's BAR1 from sysfs, held to its memory (require_bar1_covers)
| 88 | } |
| 89 | // the card's BAR1 from sysfs, held to its memory (require_bar1_covers) |
| 90 | void check_bar1(int dev, const std::string& bdf, const std::string& dir, const cudaDeviceProp& prop) { |
| 91 | const std::string path = dir + "/resource"; |
| 92 | std::FILE* f = std::fopen(path.c_str(), "r"); |
| 93 | if (!f) throw std::runtime_error("card " + std::to_string(dev) + ": cannot open " + path + " to read its BAR1 from"); |
| 94 | std::string text; |
| 95 | char buf[4096]; |
| 96 | for (size_t n; (n = std::fread(buf, 1, sizeof buf, f)) > 0;) text.append(buf, n); |
| 97 | const bool bad = std::ferror(f); |
| 98 | std::fclose(f); |
| 99 | if (bad) throw std::runtime_error("card " + std::to_string(dev) + ": cannot read " + path); |
| 100 | require_bar1_covers(dev, bdf, prop.name, bar1_bytes(text, path), prop.totalGlobalMem, NCARD); |
| 101 | } |
| 102 | #endif |
| 103 | // the Makefile passes the arch the kernels were compiled for (ARCH): a default here would let a card of another one |
| 104 | // run them through the driver's PTX compiler unchecked |
no test coverage detected