Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Commit ed7a53f

Browse files
committedFeb 14, 2018
Some fixes for uninitialized vars + removed linking hwmon to cl and cuda
1 parent 25653e9 commit ed7a53f

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed
 

‎libethash-cl/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
4545
include_directories(..)
4646

4747
add_library(ethash-cl ${SOURCES})
48-
target_link_libraries(ethash-cl PUBLIC ethcore ethash hwmon)
48+
target_link_libraries(ethash-cl PUBLIC ethcore ethash)
4949
target_link_libraries(ethash-cl PRIVATE OpenCL::OpenCL)

‎libethash-cuda/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ file(GLOB sources "*.cpp" "*.cu")
2727
file(GLOB headers "*.h" "*.cuh")
2828

2929
cuda_add_library(ethash-cuda STATIC ${sources} ${headers})
30-
target_link_libraries(ethash-cuda ethcore ethash hwmon)
30+
target_link_libraries(ethash-cuda ethcore ethash)
3131
target_include_directories(ethash-cuda PUBLIC ${CUDA_INCLUDE_DIRS})
3232
target_include_directories(ethash-cuda PRIVATE .. ${CMAKE_CURRENT_BINARY_DIR})

‎libethcore/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(SOURCES
99
include_directories(BEFORE ..)
1010

1111
add_library(ethcore ${SOURCES})
12-
target_link_libraries(ethcore ethash devcore)
12+
target_link_libraries(ethcore ethash devcore hwmon)
1313

1414
if(ETHASHCL)
1515
target_link_libraries(ethcore ethash-cl)

‎libethcore/Farm.h

+15-13
Original file line numberDiff line numberDiff line change
@@ -263,21 +263,23 @@ class Farm: public FarmFace
263263
HwMonitorInfo hwInfo = i->hwmonInfo();
264264
HwMonitor hw;
265265
unsigned int tempC = 0, fanpcnt = 0;
266-
if (hwInfo.deviceType == HwMonitorInfoType::NVIDIA && nvmlh) {
267-
wrap_nvml_get_tempC(nvmlh, hwInfo.deviceIndex, &tempC);
268-
wrap_nvml_get_fanpcnt(nvmlh, hwInfo.deviceIndex, &fanpcnt);
269-
}
270-
else if (hwInfo.deviceType == HwMonitorInfoType::AMD && adlh) {
271-
wrap_adl_get_tempC(adlh, hwInfo.deviceIndex, &tempC);
272-
wrap_adl_get_fanpcnt(adlh, hwInfo.deviceIndex, &fanpcnt);
273-
}
266+
if (hwInfo.deviceIndex >= 0) {
267+
if (hwInfo.deviceType == HwMonitorInfoType::NVIDIA && nvmlh) {
268+
wrap_nvml_get_tempC(nvmlh, hwInfo.deviceIndex, &tempC);
269+
wrap_nvml_get_fanpcnt(nvmlh, hwInfo.deviceIndex, &fanpcnt);
270+
}
271+
else if (hwInfo.deviceType == HwMonitorInfoType::AMD && adlh) {
272+
wrap_adl_get_tempC(adlh, hwInfo.deviceIndex, &tempC);
273+
wrap_adl_get_fanpcnt(adlh, hwInfo.deviceIndex, &fanpcnt);
274+
}
274275
#if defined(__linux)
275-
// Overwrite with sysfs data if present
276-
if (hwInfo.deviceType == HwMonitorInfoType::AMD && sysfsh) {
277-
wrap_amdsysfs_get_tempC(sysfsh, hwInfo.deviceIndex, &tempC);
278-
wrap_amdsysfs_get_fanpcnt(sysfsh, hwInfo.deviceIndex, &fanpcnt);
279-
}
276+
// Overwrite with sysfs data if present
277+
if (hwInfo.deviceType == HwMonitorInfoType::AMD && sysfsh) {
278+
wrap_amdsysfs_get_tempC(sysfsh, hwInfo.deviceIndex, &tempC);
279+
wrap_amdsysfs_get_fanpcnt(sysfsh, hwInfo.deviceIndex, &fanpcnt);
280+
}
280281
#endif
282+
}
281283
hw.tempC = tempC;
282284
hw.fanP = fanpcnt;
283285
p.minerMonitors.push_back(hw);

‎libethcore/Miner.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ enum class HwMonitorInfoType
7272

7373
struct HwMonitorInfo
7474
{
75-
HwMonitorInfoType deviceType;
76-
int deviceIndex;
75+
HwMonitorInfoType deviceType = HwMonitorInfoType::UNKNOWN;
76+
int deviceIndex = -1;
7777
};
7878

7979
struct HwMonitor

‎libhwmon/wrapamdsysfs.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ wrap_amdsysfs_handle * wrap_amdsysfs_create()
4949

5050
unsigned int gpucount = 0;
5151
struct dirent* dire;
52+
errno = 0;
5253
while ((dire = readdir(dirp)) != nullptr)
5354
{
5455
if (::strncmp(dire->d_name, "card", 4) != 0)

0 commit comments

Comments
 (0)