Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cusp benchmark #303

Merged
merged 13 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ add_subdirectory(matrix_statistics)
add_subdirectory(preconditioner)
add_subdirectory(solver)
add_subdirectory(spmv)
add_subdirectory(spmv_comparison_cuda)

add_custom_target(make_run_all_benchmarks ALL)
add_custom_command(
Expand Down
2 changes: 1 addition & 1 deletion benchmark/matrix_generator/matrix_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int main(int argc, char *argv[])
auto mdata = generator[type](config["problem"], engine);
std::ofstream ofs(filename);
gko::write_raw(ofs, mdata, gko::layout_type::coordinate);
} catch (std::exception &e) {
} catch (const std::exception &e) {
std::cerr << "Error generating matrix, what(): " << e.what()
<< std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/matrix_statistics/matrix_statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int main(int argc, char *argv[])
extract_matrix_statistics(matrix, test_case["problem"], allocator);

backup_results(test_cases);
} catch (std::exception &e) {
} catch (const std::exception &e) {
std::cerr << "Error extracting statistics, what(): " << e.what()
<< std::endl;
}
Expand Down
4 changes: 2 additions & 2 deletions benchmark/preconditioner/preconditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void run_preconditioner(const char *precond_name,
}

add_or_set_member(this_precond_data, "completed", true, allocator);
} catch (std::exception e) {
} catch (const std::exception &e) {
auto encoded_name = encode_parameters(precond_name);
add_or_set_member(test_case["preconditioner"], encoded_name.c_str(),
rapidjson::Value(rapidjson::kObjectType), allocator);
Expand Down Expand Up @@ -352,7 +352,7 @@ int main(int argc, char *argv[])
<< test_cases << std::endl;
backup_results(test_cases);
}
} catch (std::exception &e) {
} catch (const std::exception &e) {
std::cerr << "Error setting up preconditioner, what(): " << e.what()
<< std::endl;
}
Expand Down
8 changes: 8 additions & 0 deletions benchmark/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if [ ! "${SYSTEM_NAME}" ]; then
SYSTEM_NAME="unknown"
fi

if [ ! "${DEVICE_ID}" ]; then
echo "DEVICE_ID environment variable not set - assuming \"0\"" 1>&2
DEVICE_ID="0"
fi


################################################################################
# Utilities
Expand Down Expand Up @@ -83,6 +88,7 @@ run_spmv_benchmarks() {
cp "$1" "$1.imd" # make sure we're not loosing the original input
./spmv/spmv --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --formats="csr,coo,hybrid,sellp,ell" \
--device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
}
Expand All @@ -100,6 +106,7 @@ run_solver_benchmarks() {
--executor="${EXECUTOR}" --solvers="cg,bicgstab,cgs,fcg" \
--preconditioners="${PRECONDS}" \
--max_iters=10000 --rel_res_goal=1e-6 \
--device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
}
Expand All @@ -125,6 +132,7 @@ run_preconditioner_benchmarks() {
--executor="${EXECUTOR}" --preconditioners="jacobi" \
--max_block_size="${bsize}" \
--storage_optimization="${prec}" \
--device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
done
Expand Down
4 changes: 2 additions & 2 deletions benchmark/solver/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void solve_system(

// compute and write benchmark data
add_or_set_member(solver_json, "completed", true, allocator);
} catch (std::exception e) {
} catch (const std::exception &e) {
add_or_set_member(test_case["solver"][precond_solver_name], "completed",
false, allocator);
std::cerr << "Error when processing test case " << test_case << "\n"
Expand Down Expand Up @@ -451,7 +451,7 @@ int main(int argc, char *argv[])
++precond_solver_name;
}
}
} catch (std::exception &e) {
} catch (const std::exception &e) {
std::cerr << "Error setting up solver, what(): " << e.what()
<< std::endl;
}
Expand Down
9 changes: 9 additions & 0 deletions benchmark/spmv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
add_executable(spmv spmv.cpp)
target_link_libraries(spmv ginkgo gflags rapidjson)
if (GINKGO_BUILD_CUDA)
target_compile_definitions(spmv PRIVATE HAS_CUDA=1)
target_link_libraries(spmv ginkgo ${CUDA_RUNTIME_LIBS}
${CUBLAS} ${CUSPARSE})
target_include_directories(spmv SYSTEM PRIVATE ${CUDA_INCLUDE_DIRS})
if(CMAKE_CUDA_COMPILER_VERSION GREATER_EQUAL "9.2")
target_compile_definitions(spmv PRIVATE ALLOWMP=1)
endif()
endif()
Loading