work on gpu turbo, gpu clocks, cpu turbo

This commit is contained in:
Carl Pearson
2019-09-19 15:53:43 -05:00
parent f51ef904fb
commit 81cc7feafd
12 changed files with 383 additions and 63 deletions

39
tools/CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
# removed -Wredundant-decls for cuda 10.1
# removed -Wundef for cuda 10.0
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} \
-Xcompiler=-Wall\
-Xcompiler=-Wextra\
-Xcompiler=-Wcast-qual \
-Xcompiler=-Wcast-align \
-Xcompiler=-Wstrict-aliasing \
-Xcompiler=-Wpointer-arith \
-Xcompiler=-Winit-self \
-Xcompiler=-Wshadow \
-Xcompiler=-Wswitch-enum \
-Xcompiler=-Wfloat-equal \
-Xcompiler=-Wvla\
-Xcompiler=-fmax-errors=1 \
-Xcompiler=-Wfatal-errors\
")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-Wredundant-decls \
-Wundef \
-Wall\
-Wextra\
-Wcast-qual \
-Wcast-align \
-Wstrict-aliasing \
-Wpointer-arith \
-Winit-self \
-Wshadow \
-Wswitch-enum \
-Wfloat-equal \
-Wvla\
-fmax-errors=1 \
-Wfatal-errors\
")
add_executable(enable-turbo enable_turbo.cpp)
target_link_libraries(enable-turbo perfect)

35
tools/enable_turbo.cpp Normal file
View File

@@ -0,0 +1,35 @@
#include <iostream>
#include "perfect/cpu_turbo.hpp"
#include "perfect/init.hpp"
using namespace perfect;
int main(void) {
Result ret;
CpuTurboState state;
perfect::init();
ret = get_cpu_turbo_state(&state);
if (ret != Result::SUCCESS) {
std::cerr << "ERROR: " << get_string(ret) << "\n";
exit(EXIT_FAILURE);
}
if (is_turbo_enabled(state)) {
std::cerr << "turbo already enabled\n";
exit(EXIT_SUCCESS);
} else {
ret = enable_cpu_turbo();
if (ret != Result::SUCCESS) {
std::cerr << "ERROR: " << get_string(ret) << "\n";
exit(EXIT_FAILURE);
} else {
std::cerr << "enabled turbo\n";
exit(EXIT_SUCCESS);
}
}
}