From edaf18432a5c99329912918f3d771f1a8232bde6 Mon Sep 17 00:00:00 2001 From: nazerim <35893392+nazerim@users.noreply.github.com> Date: Sun, 28 Jan 2018 21:59:38 +0800 Subject: [PATCH 1/4] Add $(JANSSON_INCLUDES) to neoscrypt build Fix to build cleanly on Linux with jansson compatibility --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 07c589d6..0e7ff226 100644 --- a/Makefile.am +++ b/Makefile.am @@ -132,4 +132,4 @@ neoscrypt/cuda_neoscrypt.o: neoscrypt/cuda_neoscrypt.cu $(NVCC) -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_37,code=sm_37 @CUDA_INCLUDES@ -I. @CUDA_CFLAGS@ --ptxas-options="-v" -o $@ -c $< neoscrypt/cuda_neoscrypt_tpruvot.o: neoscrypt/cuda_neoscrypt_tpruvot.cu - $(NVCC) -gencode=arch=compute_61,code=sm_61 @CUDA_INCLUDES@ -I. @CUDA_CFLAGS@ --ptxas-options="-v" -o $@ -c $< + $(NVCC) -gencode=arch=compute_61,code=sm_61 @CUDA_INCLUDES@ -I. $(JANSSON_INCLUDES) @CUDA_CFLAGS@ --ptxas-options="-v" -o $@ -c $< From 39440761391dd51c8eaa5253e10e55ac72301c5c Mon Sep 17 00:00:00 2001 From: KlausT Date: Sun, 28 Jan 2018 15:57:59 +0100 Subject: [PATCH 2/4] fix linux_cpufreq() --- sysinfos.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sysinfos.cpp b/sysinfos.cpp index 6639411f..c8c4472f 100644 --- a/sysinfos.cpp +++ b/sysinfos.cpp @@ -39,18 +39,27 @@ static double linux_cputemp(int core) return tc; } -#define CPUFREQ_PATH \ - "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq" static uint32_t linux_cpufreq(int core) { - FILE *fd = fopen(CPUFREQ_PATH, "r"); uint32_t freq = 0; + FILE *fd; - if(!fd) + fd = fopen("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq", "r"); + if(fd != NULL) { fscanf(fd, "%d", &freq); fclose(fd); } + else // sometimes we don't have read permission for cpuinfo_cur_freq + { + fd = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); + if(fd != NULL) + { + fscanf(fd, "%d", &freq); + fclose(fd); + } + + } return freq; } From 8f9ad8c7bf278e826d96944ec54869c4a75c7574 Mon Sep 17 00:00:00 2001 From: klaust Date: Sun, 28 Jan 2018 17:04:23 +0100 Subject: [PATCH 3/4] add -pthread compiler flag --- configure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.sh b/configure.sh index 0255b417..d9fd3183 100755 --- a/configure.sh +++ b/configure.sh @@ -5,6 +5,6 @@ #--ptxas-options=\"-v -dlcm=cg\"" -extracflags="-march=native -std=c++11 -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16 -fno-strict-aliasing" +extracflags="-march=native -std=c++11 -pthread -fno-strict-aliasing" CUDA_CFLAGS="-O3 -std=c++11 -Xcompiler -fno-strict-aliasing,-Wall -D_FORCE_INLINES" ./configure CXXFLAGS="-O3 $extracflags" --with-cuda=/usr/local/cuda --with-nvml=libnvidia-ml.so From c198b7cefa1f91a2d6b4c98ff910009c0fe2aa39 Mon Sep 17 00:00:00 2001 From: klaust Date: Sun, 28 Jan 2018 18:30:48 +0100 Subject: [PATCH 4/4] fix device names (cherry picked from commit 911f0464e58b92239cc709fe7788de72e6a22b2d) --- ccminer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccminer.cpp b/ccminer.cpp index 18fbb195..eee8b885 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -2902,7 +2902,7 @@ int main(int argc, char *argv[]) applog(LOG_ERR, "%s", cudaGetErrorString(err)); exit(1); } - device_name[dev_id] = props.name; + device_name[dev_id] = strdup(props.name); } /* parse command line */