rockm compile success
This commit is contained in:
@@ -92,3 +92,4 @@ echo "Available algorithms:"\n\
|
||||
# Default command
|
||||
CMD ["sh", "-c", "echo 'Build completed successfully! Binaries available in /output/' && ls -la /output/"]
|
||||
|
||||
|
||||
|
@@ -92,3 +92,4 @@ ls -la *.so\n\
|
||||
# Default command
|
||||
CMD ["sh", "-c", "echo 'ROCm GPU build completed successfully!' && ls -la /output/"]
|
||||
|
||||
|
||||
|
@@ -128,3 +128,4 @@ rinhash_cuda(input, input_len, output);\n\
|
||||
# Default command
|
||||
CMD ["sh", "-c", "echo 'ROCm GPU build completed successfully!' && ls -la /output/ && echo '' && echo 'Integration guide available in INTEGRATION.md'"]
|
||||
|
||||
|
||||
|
@@ -293,3 +293,4 @@ echo " 3. For GPU acceleration, install ROCm runtime and use the libraries"
|
||||
echo ""
|
||||
|
||||
echo "RinHash ROCm GPU build system completed successfully!"
|
||||
|
||||
|
@@ -200,3 +200,4 @@ else
|
||||
fi
|
||||
|
||||
echo "cpuminer build completed successfully!"
|
||||
|
||||
|
@@ -223,3 +223,4 @@ else
|
||||
fi
|
||||
|
||||
echo "cpuminer build completed successfully!"
|
||||
|
||||
|
@@ -114,3 +114,4 @@ fi
|
||||
|
||||
echo "ROCm GPU build completed successfully!"
|
||||
|
||||
|
||||
|
@@ -111,3 +111,4 @@ fi
|
||||
|
||||
echo "ROCm GPU build completed successfully!"
|
||||
|
||||
|
||||
|
@@ -146,3 +146,4 @@ echo ""
|
||||
echo "For more information about ROCm Docker containers, visit:"
|
||||
echo "https://github.com/ROCm/ROCm-docker"
|
||||
|
||||
|
||||
|
@@ -30,3 +30,4 @@ target_compile_options(rinhash-gpu-miner PRIVATE -O3 -march=native)
|
||||
|
||||
# Install target
|
||||
install(TARGETS rinhash-gpu-miner DESTINATION bin)
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include <hip/hip_runtime.h>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <device_launch_parameters.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@@ -7,13 +7,14 @@
|
||||
#include <dlfcn.h>
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
|
||||
// HIP/ROCm runtime check (using dlopen, no direct headers needed)
|
||||
|
||||
// Forward declarations for GPU functions
|
||||
extern "C" {
|
||||
void rinhash_cuda(const uint8_t* input, size_t input_len, uint8_t* output);
|
||||
void rinhash_cuda_batch(const uint8_t* block_headers, size_t block_header_len,
|
||||
void rinhash_hip(const uint8_t* input, size_t input_len, uint8_t* output);
|
||||
void rinhash_hip_batch(const uint8_t* block_headers, size_t block_header_len,
|
||||
uint8_t* outputs, uint32_t num_blocks);
|
||||
void RinHash(const uint32_t* version, const uint32_t* prev_block,
|
||||
const uint32_t* merkle_root, const uint32_t* timestamp,
|
||||
@@ -26,8 +27,8 @@ private:
|
||||
bool gpu_available;
|
||||
|
||||
// Function pointers for GPU operations
|
||||
decltype(&rinhash_cuda) gpu_rinhash;
|
||||
decltype(&rinhash_cuda_batch) gpu_rinhash_batch;
|
||||
decltype(&rinhash_hip) gpu_rinhash;
|
||||
decltype(&rinhash_hip_batch) gpu_rinhash_batch;
|
||||
decltype(&RinHash) gpu_RinHash;
|
||||
|
||||
// Mining parameters
|
||||
@@ -61,30 +62,38 @@ public:
|
||||
}
|
||||
|
||||
bool loadGPULibrary() {
|
||||
// Try to load the GPU library
|
||||
gpu_lib_handle = dlopen("./rocm-direct-output/gpu-libs/librinhash_hip.so", RTLD_LAZY);
|
||||
if (!gpu_lib_handle) {
|
||||
std::cerr << "Failed to load GPU library: " << dlerror() << std::endl;
|
||||
std::cerr << "Make sure to run: sudo cp rocm-direct-output/gpu-libs/librinhash_hip.so /usr/local/lib/" << std::endl;
|
||||
return false;
|
||||
}
|
||||
// Try to load the GPU library
|
||||
std::cout << "Attempting to load GPU library..." << std::endl;
|
||||
gpu_lib_handle = dlopen("./rocm-direct-output/gpu-libs/librinhash_hip.so", RTLD_LAZY);
|
||||
if (!gpu_lib_handle) {
|
||||
std::cerr << "Failed to load GPU library: " << dlerror() << std::endl;
|
||||
std::cerr << "Make sure to run: sudo cp rocm-direct-output/gpu-libs/librinhash_hip.so /usr/local/lib/" << std::endl;
|
||||
std::cerr << "Current working directory: " << std::filesystem::current_path() << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::cout << "GPU library loaded successfully!" << std::endl;
|
||||
|
||||
// Load function pointers
|
||||
gpu_rinhash = (decltype(gpu_rinhash))dlsym(gpu_lib_handle, "rinhash_cuda");
|
||||
gpu_rinhash_batch = (decltype(gpu_rinhash_batch))dlsym(gpu_lib_handle, "rinhash_cuda_batch");
|
||||
gpu_RinHash = (decltype(gpu_RinHash))dlsym(gpu_lib_handle, "RinHash");
|
||||
// Load function pointers
|
||||
std::cout << "Loading GPU functions..." << std::endl;
|
||||
gpu_rinhash = (decltype(gpu_rinhash))dlsym(gpu_lib_handle, "rinhash_hip");
|
||||
gpu_rinhash_batch = (decltype(gpu_rinhash_batch))dlsym(gpu_lib_handle, "rinhash_hip_batch");
|
||||
gpu_RinHash = (decltype(gpu_RinHash))dlsym(gpu_lib_handle, "RinHash");
|
||||
|
||||
if (!gpu_rinhash || !gpu_rinhash_batch || !gpu_RinHash) {
|
||||
std::cerr << "Failed to load GPU functions: " << dlerror() << std::endl;
|
||||
dlclose(gpu_lib_handle);
|
||||
gpu_lib_handle = nullptr;
|
||||
return false;
|
||||
}
|
||||
if (!gpu_rinhash) std::cerr << "Failed to load rinhash_hip" << std::endl;
|
||||
if (!gpu_rinhash_batch) std::cerr << "Failed to load rinhash_hip_batch" << std::endl;
|
||||
if (!gpu_RinHash) std::cerr << "Failed to load RinHash" << std::endl;
|
||||
|
||||
if (!gpu_rinhash || !gpu_rinhash_batch || !gpu_RinHash) {
|
||||
std::cerr << "Failed to load GPU functions: " << dlerror() << std::endl;
|
||||
dlclose(gpu_lib_handle);
|
||||
gpu_lib_handle = nullptr;
|
||||
return false;
|
||||
}
|
||||
std::cout << "GPU functions loaded successfully!" << std::endl;
|
||||
|
||||
// GPU availability will be verified by successful library loading
|
||||
// and function calls working properly
|
||||
|
||||
std::cout << "GPU library loaded successfully!" << std::endl;
|
||||
std::cout << "GPU functions ready for mining" << std::endl;
|
||||
|
||||
gpu_available = true;
|
||||
@@ -149,7 +158,12 @@ public:
|
||||
}
|
||||
|
||||
// Process batch on GPU
|
||||
gpu_rinhash_batch(block_headers.data(), block_header_len, hashes.data(), num_nonces);
|
||||
if (gpu_rinhash_batch) {
|
||||
gpu_rinhash_batch(block_headers.data(), block_header_len, hashes.data(), num_nonces);
|
||||
} else {
|
||||
std::cerr << "GPU batch function not available" << std::endl;
|
||||
return false;
|
||||
}
|
||||
hashes_computed += num_nonces;
|
||||
|
||||
// Check results
|
||||
|
BIN
rin/miner/rinhash-gpu-miner
Normal file
BIN
rin/miner/rinhash-gpu-miner
Normal file
Binary file not shown.
Reference in New Issue
Block a user