Skip to content

Commit

Permalink
feat: use cuda flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Jun 21, 2024
1 parent e47263b commit 5b41c18
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
37 changes: 0 additions & 37 deletions pkg/resourceprovider/cudaminer/keccak.cu
Original file line number Diff line number Diff line change
Expand Up @@ -327,40 +327,3 @@ extern "C" __global__ __launch_bounds__(1024)

delete nonce;//45
}


extern "C" __global__ __launch_bounds__(1024)

void kernel_lilypad_pow_debug(uint8_t* chanllenge, uint64_t* startNonce, uint64_t* target, uint64_t n_batch, uint8_t* resNonce, uint8_t *hash, uint8_t *pack)
{
uint64_t thread = blockIdx.x * blockDim.x + threadIdx.x; //4
if (thread >= n_batch) {//36
return;
}

//pack input
uint8_t in[64];
memcpy(in, chanllenge, 32);
//increase nonce
uint8_t* nonce = (uint8_t*)addUint256(startNonce, thread);//35
uint8_t nonce_rev[32];
reverse32BytesInPlace(nonce, nonce_rev);//18
memcpy(in+32, nonce_rev, 32);


uint8_t out[32];
CUDA_KECCAK_CTX ctx;
cuda_keccak_init(&ctx); //6
cuda_keccak_update(&ctx, in,64); //12
cuda_keccak_final_rev(&ctx, out); //6

if (hashbelowtarget((uint64_t*)out, target)) {//49
// uint8_t out_rev[64];
// reverse32BytesInPlace(out, out_rev);//18
// memcpy(hash, out_rev, 32);
// memcpy(pack, in, 64);
memcpy(resNonce, nonce_rev, 32);
}

delete nonce;//45
}
4 changes: 2 additions & 2 deletions pkg/resourceprovider/cudaworker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux
// +build linux
//go:build cuda
// +build cuda

package resourceprovider

Expand Down
4 changes: 2 additions & 2 deletions pkg/resourceprovider/others_os.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !linux
// +build !linux
//go:build !cuda
// +build !cuda

package resourceprovider

Expand Down

0 comments on commit 5b41c18

Please sign in to comment.