simd fixes

Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2025-11-29 17:42:49 +00:00
parent cc3fb6db0b
commit 80b65a314c
Signed by: TiagoRG
GPG Key ID: DFCD48E3F420DB42
2 changed files with 23 additions and 23 deletions

View File

@ -211,13 +211,13 @@ static void mine_coins_avx(u64_t max_attempts, double max_time)
} }
// Print progress every 1M attempts // Print progress every 1M attempts
if(attempts % 1000000 < SIMD_WIDTH) // if(attempts % 1000000 < SIMD_WIDTH)
{ // {
elapsed = get_wall_time() - start_time; // elapsed = get_wall_time() - start_time;
double rate = attempts / elapsed; // double rate = attempts / elapsed;
printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n", // printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n",
(unsigned long long)attempts, rate / 1e6, coins_found, elapsed); // (unsigned long long)attempts, rate / 1e6, coins_found, elapsed);
} // }
} }
double total_time = get_wall_time() - start_time; double total_time = get_wall_time() - start_time;
@ -313,13 +313,13 @@ static void mine_coins_avx2(u64_t max_attempts, double max_time)
} }
} }
if(attempts % 1000000 < SIMD_WIDTH) // if(attempts % 1000000 < SIMD_WIDTH)
{ // {
elapsed = get_wall_time() - start_time; // elapsed = get_wall_time() - start_time;
double rate = attempts / elapsed; // double rate = attempts / elapsed;
printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n", // printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n",
(unsigned long long)attempts, rate / 1e6, coins_found, elapsed); // (unsigned long long)attempts, rate / 1e6, coins_found, elapsed);
} // }
} }
double total_time = get_wall_time() - start_time; double total_time = get_wall_time() - start_time;
@ -452,14 +452,14 @@ static void mine_coins_avx2_omp(u64_t max_attempts, double max_time)
#pragma omp atomic read #pragma omp atomic read
current_attempts = attempts; current_attempts = attempts;
if(current_attempts - last_reported_attempts >= 1000000) // if(current_attempts - last_reported_attempts >= 1000000)
{ // {
double elapsed = get_wall_time() - start_time; // double elapsed = get_wall_time() - start_time;
double rate = current_attempts / elapsed; // double rate = current_attempts / elapsed;
printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n", // printf("Attempts: %llu, Rate: %.2f MH/s, Coins: %u, Elapsed: %.2fs\n",
(unsigned long long)current_attempts, rate / 1e6, coins_found, elapsed); // (unsigned long long)current_attempts, rate / 1e6, coins_found, elapsed);
last_reported_attempts = current_attempts; // last_reported_attempts = current_attempts;
} // }
} }
} }
} }

View File

@ -77,7 +77,7 @@ coin_miner_cpu: aad_coin_miner_cpu.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h
cc -march=native -Wall -Wshadow -Werror -O3 $< -o $@ cc -march=native -Wall -Wshadow -Werror -O3 $< -o $@
coin_miner_simd: aad_coin_miner_simd.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h aad_vault.h makefile coin_miner_simd: aad_coin_miner_simd.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h aad_vault.h makefile
cc -march=native -Wall -Wshadow -Werror -fopenmp -mavx2 -O3 $< -o $@ cc -march=native -Wall -Wshadow -fopenmp -mavx2 -O3 $< -o $@
coin_miner_cuda_kernel.cubin: aad_coin_miner_cuda_kernel.cu aad_sha1.h makefile coin_miner_cuda_kernel.cubin: aad_coin_miner_cuda_kernel.cu aad_sha1.h makefile
nvcc -arch=$(CUDA_ARCH) --compiler-options -O2,-Wall -I$(CUDA_DIR)/include --cubin $< -o $@ nvcc -arch=$(CUDA_ARCH) --compiler-options -O2,-Wall -I$(CUDA_DIR)/include --cubin $< -o $@