Add rsmi_version_get() function

Also, modify CMakeLists.txt to use git tags to determine the
shared library version for the SONAME and the ROCm build for the
package name.
This commit is contained in:
Chris Freehill
2018-12-06 13:48:59 -06:00
parent bc200d205e
commit 5a9a729b31
6 changed files with 206 additions and 91 deletions
+18
View File
@@ -59,6 +59,7 @@
#include "rocm_smi/rocm_smi_device.h"
#include "rocm_smi/rocm_smi_utils.h"
#include "rocm_smi/rocm_smi_exception.h"
#include "rocm_smi/rocm_smi64Config.h"
static const uint32_t kMaxOverdriveLevel = 20;
@@ -1117,3 +1118,20 @@ rsmi_dev_busy_percent_get(uint32_t dv_ind, uint32_t *busy_percent) {
CATCH
}
rsmi_status_t
rsmi_version_get(rsmi_version *version) {
TRY
if (version == nullptr) {
return RSMI_STATUS_INVALID_ARGS;
}
version->major = rocm_smi_VERSION_MAJOR;
version->minor = rocm_smi_VERSION_MINOR;
version->patch = rocm_smi_VERSION_PATCH;
version->build = rocm_smi_VERSION_BUILD;
return RSMI_STATUS_SUCCESS;
CATCH
}
+56
View File
@@ -0,0 +1,56 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2017, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Developed by:
*
* AMD Research and AMD ROC Software Development
*
* Advanced Micro Devices, Inc.
*
* www.amd.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal with the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimers.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimers in
* the documentation and/or other materials provided with the distribution.
* - Neither the names of <Name of Development Group, Name of Institution>,
* nor the names of its contributors may be used to endorse or promote
* products derived from this Software without specific prior written
* permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_
// This file is generated on build.
#define rocm_smi_VERSION_MAJOR @rocm_smi_VERSION_MAJOR@
#define rocm_smi_VERSION_MINOR @rocm_smi_VERSION_MINOR@
#define rocm_smi_VERSION_PATCH @rocm_smi_VERSION_PATCH@
#define rocm_smi_VERSION_BUILD "@rocm_smi_VERSION_BUILD@"
#endif // INCLUDE_ROCM_SMI_ROCM_SMI64CONFIG_H_