Hello. I have been following puddinpop's topic "RPC Miners (CPU/4way/CUDA/OpenCL)" <https://bitcointalk.org/index.php?topic=2444.0>, because I have been trying to compile rpcminer-cuda. I have read every post related to that in the 15 pages.
I am not an expert (I have no idea on C++, NVCC or anything), but I do know some commands in bash. I am building a script that helps other users of Ubuntu 10.04 (may work for other versions of linux) to do the compilation automatically (I attach it if you want to read it). It is just following the steps as far as I got in the compilation, thanks to the posts of others.
As you can see, I'm trying to get some help to help myself and others. Thanks.
<code>
#!/bin/bash
# Script to modify the source to build rpcminer with CUDA support
echo "Make sure to have installed the CUDA drivers and toolkit";
echo "You can go to
https://developer.nvidia.com/cuda-downloads";
echo "and
https://help.ubuntu.com/community/Cuda";
sleep 3;
# 0. Prepare the environment
Unpack the zip file with the source and go into the folder
unzip -q -d rpcminer `ls bitcoin-remote-rpc-*-src.zip` && cd rpcminer
# 1. Open up the CMakeLists.txt. There's a group of seven options
# (lines 5-11 in my version of the file for me). I set "Enable CUDA
# miner" and "Build RPC miner" to ON and everythign else to OFF.
sed -i 's-\(OPTION(BITCOIN_\(ENABLE\|BUILD\)_\(OPENCL\|REMOTE\|GUI\|DAEMON\).*\)ON)-\1OFF)-g;' CMakeLists.txt;
# 2. Ran cmake → go to step 4
# 3. Cleaned up some compile errors:
# 3A. Added "#include <limits.h>"
# and "using namespace boost;" to serialize.h after the rest of the
# #includes
# 3A-a. Find last line with #include (after the boost library;
# there is another include near line 1112)
last_line_include_boost=`sed -n '/\#include.*boost/=' ./src/serialize.h | tail -n 1`;
# 3A-b. Add both "#include <limits.h>" and "using namespace boost;"
sed -i $last_line_include_boost's-^\(.*\)$-\1\n\#include <limits.h>\nusing namespace boost\;-g' ./src/serialize.h;
# 3C. Modified bitcoinminercuda.cu to "#define _BITCOIN_MINER_CUDA_"
# right above the #ifdef that checks for it.
# 3C-a. For every file named "bitcoinminercuda.cu", check if it does
# not have "#define _BITCOIN_MINER_CUDA_". If that is the case, find
# the line with "#ifdef _BITCOIN_MINER_CUDA_", and put
# "#define# _BITCOIN_MINER_CUDA_" before it
for i in `find ./ -iname 'bitcoinminercuda.cu'`; do
if [[ -z `grep '#define _BITCOIN_MINER_CUDA_' "$i"` ]]; then
sed -i '/\#ifdef _BITCOIN_MINER_CUDA_/{x;s-.*-\#define _BITCOIN_MINER_CUDA_-;p;x}' "$i";
fi;
done;
#4. Ran make → Ran cmake and make
cmake ./ && make
#5. Build the appropriate ".cubin" file
fad
#5A. Ask the user to input the correct version of the compute
#capabilities for their GPU
#
http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/Building#
http://ondoc.logand.com/d/365/html#
https://en.wikipedia.org/wiki/CUDA#
http://docs.nvidia.com/cuda/cuda-c-programming-guide/#5A-a. Print message with the link to find the right information
echo "Visit the website
https://developer.nvidia.com/cuda-gpus";
echo "and look for the Compute Capability corresponding to the model";
echo "of your GPU. Then input the number and press enter";
#5A-b. Read value from standard input
read GPU_CompCap;
#5A-c. Delete the period in the version
GPU_CompCap=`echo "$GPU_CompCap" | tr -d '.'`;
nvcc ../src/cuda/bitcoinminercuda.cu -gencode arch=compute_"$GPU_CompCap",\"code=sm_$GPU_CompCap,compute_$GPU_CompCap\" --keep
## exits with error ↓
#/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
#(.text+0x20): undefined reference to `main'
#collect2: ld returned 1 exit status
##
</code>