Skip to content

Commit c1cba4c

Browse files
author
Rohan Yadav
committed
Merge branch 'main' of github.com:tensor-compiler/array-programming-benchmarks into main
2 parents e34ee0b + 2555741 commit c1cba4c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

taco/ufuncs.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,13 @@ struct SuiteSparseTensors {
255255
SuiteSparseTensors() {
256256
auto ssTensorPath = getTacoTensorPath();
257257
ssTensorPath += "suitesparse/";
258-
for (auto& entry : std::experimental::filesystem::directory_iterator(ssTensorPath)) {
259-
std::string f(entry.path());
260-
// Check that the filename ends with .mtx.
261-
if (f.compare(f.size() - 4, 4, ".mtx") == 0) {
262-
this->tensors.push_back(entry.path());
258+
if (std::experimental::filesystem::exists(ssTensorPath)) {
259+
for (auto& entry : std::experimental::filesystem::directory_iterator(ssTensorPath)) {
260+
std::string f(entry.path());
261+
// Check that the filename ends with .mtx.
262+
if (f.compare(f.size() - 4, 4, ".mtx") == 0) {
263+
this->tensors.push_back(entry.path());
264+
}
263265
}
264266
}
265267
}
@@ -269,6 +271,10 @@ struct SuiteSparseTensors {
269271
SuiteSparseTensors ssTensors;
270272

271273
static void bench_suitesparse_ufunc(benchmark::State& state, Func op) {
274+
if (ssTensors.tensors.size() == 0) {
275+
state.error_occurred();
276+
return;
277+
}
272278
int tensorIdx = state.range(0);
273279
auto tensorPath = ssTensors.tensors[tensorIdx];
274280
auto pathSplit = taco::util::split(tensorPath, "/");

0 commit comments

Comments
 (0)