Browse Source

neoscrypt: fixes for windows

master
Tanguy Pruvot 10 years ago
parent
commit
73af5c583c
  1. 2
      Makefile.am
  2. 4
      ccminer.vcxproj
  3. 6
      ccminer.vcxproj.filters
  4. 5
      neoscrypt/neoscrypt-cpu.c
  5. 20
      neoscrypt/neoscrypt.cpp

2
Makefile.am

@ -41,7 +41,7 @@ ccminer_SOURCES = elist.h miner.h compat.h \
quark/cuda_bmw512.cu quark/cuda_quark_keccak512.cu \ quark/cuda_bmw512.cu quark/cuda_quark_keccak512.cu \
quark/quarkcoin.cu quark/animecoin.cu \ quark/quarkcoin.cu quark/animecoin.cu \
quark/cuda_quark_compactionTest.cu \ quark/cuda_quark_compactionTest.cu \
neoscrypt.cpp neoscrypt/neoscrypt.c neoscrypt/cuda_neoscrypt.cu \ neoscrypt/neoscrypt.cpp neoscrypt/neoscrypt-cpu.c neoscrypt/cuda_neoscrypt.cu \
cuda_nist5.cu pentablake.cu skein.cu skein2.cu zr5.cu \ cuda_nist5.cu pentablake.cu skein.cu skein2.cu zr5.cu \
sph/bmw.c sph/blake.c sph/groestl.c sph/jh.c sph/keccak.c sph/skein.c \ sph/bmw.c sph/blake.c sph/groestl.c sph/jh.c sph/keccak.c sph/skein.c \
sph/cubehash.c sph/echo.c sph/luffa.c sph/sha2.c sph/shavite.c sph/simd.c \ sph/cubehash.c sph/echo.c sph/luffa.c sph/sha2.c sph/shavite.c sph/simd.c \

4
ccminer.vcxproj

@ -265,8 +265,8 @@
<ClCompile Include="myriadgroestl.cpp" /> <ClCompile Include="myriadgroestl.cpp" />
<ClCompile Include="lyra2\Lyra2.c" /> <ClCompile Include="lyra2\Lyra2.c" />
<ClCompile Include="lyra2\Sponge.c" /> <ClCompile Include="lyra2\Sponge.c" />
<ClCompile Include="neoscrypt\neoscrypt.c" /> <ClCompile Include="neoscrypt\neoscrypt-cpu.c" />
<ClCompile Include="neoscrypt.cpp" /> <ClCompile Include="neoscrypt\neoscrypt.cpp" />
<ClCompile Include="sph\aes_helper.c" /> <ClCompile Include="sph\aes_helper.c" />
<ClCompile Include="sph\blake.c" /> <ClCompile Include="sph\blake.c" />
<ClCompile Include="sph\bmw.c" /> <ClCompile Include="sph\bmw.c" />

6
ccminer.vcxproj.filters

@ -120,9 +120,9 @@
<ClCompile Include="groestlcoin.cpp"> <ClCompile Include="groestlcoin.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="neoscrypt.cpp"> <ClCompile Include="neoscrypt\neoscrypt.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</CudaCompile> </ClCompile>
<ClCompile Include="sph\aes_helper.c"> <ClCompile Include="sph\aes_helper.c">
<Filter>Source Files\sph</Filter> <Filter>Source Files\sph</Filter>
</ClCompile> </ClCompile>
@ -234,7 +234,7 @@
<ClCompile Include="scrypt-jane.cpp"> <ClCompile Include="scrypt-jane.cpp">
<Filter>Source Files\CUDA\scrypt</Filter> <Filter>Source Files\CUDA\scrypt</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="neoscrypt\neoscrypt.c"> <ClCompile Include="neoscrypt\neoscrypt-cpu.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

5
neoscrypt/neoscrypt.c → neoscrypt/neoscrypt-cpu.c

@ -34,8 +34,7 @@
#include "neoscrypt.h" #include "neoscrypt.h"
#ifdef WIN32
#if (WINDOWS)
/* sizeof(unsigned long) = 4 for MinGW64 */ /* sizeof(unsigned long) = 4 for MinGW64 */
typedef unsigned long long ulong; typedef unsigned long long ulong;
#else #else
@ -45,11 +44,9 @@ typedef unsigned int uint;
typedef unsigned char uchar; typedef unsigned char uchar;
typedef unsigned int bool; typedef unsigned int bool;
#define MIN(a, b) ((a) < (b) ? a : b) #define MIN(a, b) ((a) < (b) ? a : b)
#define MAX(a, b) ((a) > (b) ? a : b) #define MAX(a, b) ((a) > (b) ? a : b)
/* SHA-256 */ /* SHA-256 */
static const uint32_t sha256_constants[64] = { static const uint32_t sha256_constants[64] = {

20
neoscrypt.cpp → neoscrypt/neoscrypt.cpp

@ -1,10 +1,6 @@
#include <cuda_runtime.h>
extern "C" {
#include "neoscrypt/neoscrypt.h"
}
#include "cuda_helper.h"
#include "miner.h" #include "miner.h"
#include "neoscrypt/neoscrypt.h"
static uint32_t *d_hash[MAX_GPUS] ; static uint32_t *d_hash[MAX_GPUS] ;
extern void neoscrypt_setBlockTarget(uint32_t * data, const void *ptarget); extern void neoscrypt_setBlockTarget(uint32_t * data, const void *ptarget);
@ -13,6 +9,8 @@ extern uint32_t neoscrypt_cpu_hash_k4(int stratum, int thr_id, uint32_t threads,
#define SHIFT 130 #define SHIFT 130
static bool init[MAX_GPUS] = { 0 };
int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done)
{ {
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
@ -25,17 +23,21 @@ int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uin
throughput = throughput / 32; /* set for max intensity ~= 20 */ throughput = throughput / 32; /* set for max intensity ~= 20 */
throughput = min(throughput, max_nonce - first_nonce + 1); throughput = min(throughput, max_nonce - first_nonce + 1);
static bool init[MAX_GPUS] = { 0 };
if (!init[thr_id]) if (!init[thr_id])
{ {
cudaSetDevice(device_map[thr_id]); cudaSetDevice(device_map[thr_id]);
cudaDeviceSetCacheConfig(cudaFuncCachePreferL1); cudaDeviceSetCacheConfig(cudaFuncCachePreferL1);
CUDA_SAFE_CALL(cudaMalloc(&d_hash[thr_id], 32 * SHIFT * sizeof(uint64_t) * throughput)); cudaMalloc(&d_hash[thr_id], 32 * SHIFT * sizeof(uint64_t) * throughput);
neoscrypt_cpu_init(thr_id, throughput, d_hash[thr_id]); neoscrypt_cpu_init(thr_id, throughput, d_hash[thr_id]);
applog(LOG_INFO, "Using %d cuda threads", throughput); applog(LOG_INFO, "Using %d cuda threads", throughput);
if (cudaGetLastError() != cudaSuccess) {
cudaError_t err = cudaGetLastError();
fprintf(stderr, "Cuda error in func '%s' at line %i : %s.\n",
__FUNCTION__, __LINE__, cudaGetErrorString(err) );
proper_exit(EXIT_FAILURE);
}
init[thr_id] = true; init[thr_id] = true;
} }
Loading…
Cancel
Save