Squashed commit of the following:
commit 25e7cb77683736a588acb6b30a8ac89e2bd7f56a Author: Carl Pearson <pearson@illinois.edu> Date: Fri Sep 20 13:25:49 2019 -0500 automatically define PERFECT_HAS_CUDA with nvcc commit fcc699c165ba515619781aefb378d3c0c4d1093d Author: Carl Pearson <pearson@illinois.edu> Date: Fri Sep 20 13:18:42 2019 -0500 optional CUDA support
This commit is contained in:
@@ -43,8 +43,12 @@ target_link_libraries(cpu-turbo perfect)
|
||||
add_executable(os-perf os_perf.cpp)
|
||||
target_link_libraries(os-perf perfect)
|
||||
|
||||
add_executable(gpu-clocks gpu_clocks.cu)
|
||||
target_link_libraries(gpu-clocks perfect)
|
||||
if(CMAKE_CUDA_COMPILER)
|
||||
add_executable(gpu-clocks gpu_clocks.cu)
|
||||
target_link_libraries(gpu-clocks perfect)
|
||||
endif()
|
||||
|
||||
add_executable(gpu-turbo gpu_turbo.cu)
|
||||
target_link_libraries(gpu-turbo perfect)
|
||||
if(CMAKE_CUDA_COMPILER)
|
||||
add_executable(gpu-turbo gpu_turbo.cu)
|
||||
target_link_libraries(gpu-turbo perfect)
|
||||
endif()
|
@@ -3,24 +3,25 @@
|
||||
#include <map>
|
||||
|
||||
int main(void) {
|
||||
perfect::init();
|
||||
perfect::init();
|
||||
|
||||
std::map<int, perfect::OsPerfState> states;
|
||||
std::map<int, perfect::OsPerfState> states;
|
||||
|
||||
for (auto cpu : perfect::cpus()) {
|
||||
perfect::OsPerfState state;
|
||||
perfect::get_os_perf_state(&state, cpu);
|
||||
states[cpu] = state;
|
||||
perfect::os_perf_state_maximum(cpu);
|
||||
for (auto cpu : perfect::cpus()) {
|
||||
perfect::OsPerfState state;
|
||||
perfect::Result result;
|
||||
result = perfect::get_os_perf_state(&state, cpu);
|
||||
if (perfect::Result::SUCCESS == result) {
|
||||
states[cpu] = state;
|
||||
}
|
||||
perfect::os_perf_state_maximum(cpu);
|
||||
}
|
||||
|
||||
// do things with all CPUs set to the maximum performancem mode by the OS
|
||||
|
||||
for (auto kv : states) {
|
||||
int cpu = kv.first;
|
||||
perfect::OsPerfState state = kv.second;
|
||||
perfect::set_os_perf_state(cpu, state);
|
||||
}
|
||||
|
||||
// do things with all CPUs set to the maximum performancem mode by the OS
|
||||
|
||||
for (auto kv : states) {
|
||||
int cpu = kv.first;
|
||||
perfect::OsPerfState state = kv.second;
|
||||
perfect::set_os_perf_state(cpu, state);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user