MCPcopy Create free account
hub / github.com/Niko1221/Strata / check_bar1

Function check_bar1

engine/src/split/src/model.cpp:90–101  ·  view source on GitHub ↗

the card's BAR1 from sysfs, held to its memory (require_bar1_covers)

Source from the content-addressed store, hash-verified

88}
89// the card's BAR1 from sysfs, held to its memory (require_bar1_covers)
90void 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

Callers 1

check_cardsFunction · 0.85

Calls 4

require_bar1_coversFunction · 0.85
bar1_bytesFunction · 0.85
to_stringFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected