Skip to content

Commit

Permalink
#5: added TplsVersion file and print methods
Browse files Browse the repository at this point in the history
  • Loading branch information
meriadeg perrinel authored and cz4rs committed Mar 14, 2023
1 parent 26bf333 commit dc8c7d1
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 15 deletions.
38 changes: 23 additions & 15 deletions common/src/KokkosKernels_PrintConfiguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,31 @@
#define _KOKKOSKERNELS_PRINT_CONFIGURATION_HPP

#include "KokkosKernels_config.h"

#include "KokkosKernels_TplsVersion.hpp"
#include <iostream>

namespace KokkosKernels {
namespace Impl {

inline void print_cublas_version(std::ostream& os) {
#ifdef KOKKOSKERNELS_ENABLE_TPL_CUBLAS
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: " << get_cublas_version() << "\n";
#else
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: no\n";
#endif
}

inline void print_cusparse_version(std::ostream& os) {
#ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: " << get_cusparse_version() << "\n";
#else
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: no\n";
#endif
}
inline void print_enabled_tpls(std::ostream& os) {
#ifdef KOKKOSKERNELS_ENABLE_TPL_LAPACK
os << " "
Expand Down Expand Up @@ -73,20 +93,8 @@ inline void print_enabled_tpls(std::ostream& os) {
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_MKL: no\n";
#endif
#ifdef KOKKOSKERNELS_ENABLE_TPL_CUBLAS
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: yes\n";
#else
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUBLAS: no\n";
#endif
#ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: yes\n";
#else
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_CUSPARSE: no\n";
#endif
print_cublas_version(os);
print_cusparse_version(os);
#ifdef KOKKOSKERNELS_ENABLE_TPL_ROCBLAS
os << " "
<< "KOKKOSKERNELS_ENABLE_TPL_ROCBLAS: yes\n";
Expand Down
58 changes: 58 additions & 0 deletions common/src/KokkosKernels_TplsVersion.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//@HEADER
// ************************************************************************
//
// Kokkos v. 4.0
// Copyright (2022) National Technology & Engineering
// Solutions of Sandia, LLC (NTESS).
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
// See https://kokkos.org/LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//@HEADER

#ifndef _KOKKOSKERNELS_TPLS_VERSIONS_HPP
#define _KOKKOSKERNELS_TPLS_VERSIONS_HPP

#include "KokkosKernels_config.h"
#include <iostream>

#if defined(KOKKOSKERNELS_ENABLE_TPL_CUBLAS)
#include "cublas_v2.h"
#endif

#if defined(KOKKOSKERNELS_ENABLE_TPL_CUSPARSE)
#include "cusparse.h"
#endif

namespace KokkosKernels {

#if defined(KOKKOSKERNELS_ENABLE_TPL_CUBLAS)
inline std::string get_cublas_version() {
// Print version
std::stringstream ss;

ss << CUBLAS_VER_MAJOR << "." << CUBLAS_VER_MINOR << "." << CUBLAS_VER_PATCH
<< CUBLAS_VER_BUILD;

return ss.str();
}
#endif

#if defined(KOKKOSKERNELS_ENABLE_TPL_CUSPARSE)
inline std::string get_cusparse_version() {
// Print version
std::stringstream ss;

ss << CUSPARSE_VER_MAJOR << "." << CUSPARSE_VER_MINOR << "."
<< CUSPARSE_VER_PATCH << CUSPARSE_VER_BUILD;

return ss.str();
}
#endif

} // namespace KokkosKernels
#endif // _KOKKOSKERNELS_TPLS_VERSIONS_HPP

0 comments on commit dc8c7d1

Please sign in to comment.