Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opencl #35

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# 0xBitcoin ERC20 Token Miner

Solves proof of work to mine supported ERC20 tokens. This is a CPU miner. (See Releases for links to GPU miners.)
Solves proof of work to mine supported ERC20 tokens. This is a CPU/GPU miner. (See Releases for links to GPU miners.)



Expand All @@ -18,6 +18,12 @@ This new build uses miner-config.js for setting parameters and no longer has an

### Building from Source


#### Prerequisites
1. Install OpenCL Headers
a. Ubuntu 20 (EASY): sudo apt install ocl-icd-opencl-dev
(headers will be at -> /usr/lib/x86_64-linux-gnu/libOpenCL.so)

#### Setup (Windows/Linux)
1. Install NodeJS 10 (nvm install 10)
2. Clone/download the project
Expand Down Expand Up @@ -82,6 +88,11 @@ REMINDER: You >can< set the web3provider to a ropsten, mainnet, or other type of



## Dev TODO:
* cpp/gpuminer/addon.cc is complete
* cpp/cpuminer/gpuminer.cpp is basically complete

1. need to bind gpuminer.cpp to solver.cpp now



Expand Down
22 changes: 22 additions & 0 deletions binding-cpu.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
'conditions': [
[ 'OS=="win"', {'variables': {'obj': 'obj'}},
{'variables': {'obj': 'o'}}]],

"targets": [


{
"target_name": "cpuminer",
"sources": [
"cpp/cpuminer/addon.cc",
"cpp/cpuminer/cpuminer.cpp",
"cpp/cpuminer/solver.cpp",
"cpp/cpuminer/sha3.c"
],
'cflags_cc+': [ '-march=native', '-O3', '-std=c++17' ],
"include_dirs": ["<!(node -e \"require('nan')\")"]
}

]
}
104 changes: 95 additions & 9 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
'conditions': [
[ 'OS=="win"', {'variables': {'obj': 'obj'}},
{'variables': {'obj': 'o'}}]],
'targets': [

"targets": [


{
{
"target_name": "cpuminer",
"sources": [
"cpp/cpuminer/addon.cc",
Expand All @@ -16,7 +11,98 @@
],
'cflags_cc+': [ '-march=native', '-O3', '-std=c++17' ],
"include_dirs": ["<!(node -e \"require('nan')\")"]
}
},

{
'target_name': 'opencl',
'defines': [
'VERSION=0.4.5',
'NOCL_REALEASE_DRIVER_ISSUES'
],
'sources': [
'cpp/gpuminer/addon.cc',
'cpp/gpuminer/OpenClSolver.h'

],
'include_dirs' : [
"<!(node -e \"require('nan')\")",
],
'conditions': [
['OS=="mac"', {
'include_dirs' : [
"<!(echo $OPENCL_HEADER)",
],
# 'make_global_settings': [
# ['CC', '/usr/bin/clang'],
# ['CXX', '/usr/bin/clang++'],
# ],
"xcode_settings": {
'OTHER_CPLUSPLUSFLAGS' : ['-mavx','-O3','-std=c++11','-stdlib=libc++','-Wall'],
'OTHER_LDFLAGS': ['-stdlib=libc++'],
'MACOSX_DEPLOYMENT_TARGET': '10.10'
},
'libraries': ['-framework OpenCL'],
}],
['OS in "linux freebsd openbsd solaris android"', {
'variables' : {
# AMD APP SDK
'AMD_OPENCL_SDK' : '<!(echo $AMDAPPSDKROOT)',
'AMD_OPENCL_SDK_INCLUDE' : '<(AMD_OPENCL_SDK)/include',
'AMD_OPENCL_SDK_LIB' : '<(AMD_OPENCL_SDK)/lib/x86_64',

# NVIDA CUDA SDK
'NVIDA_CUDA_SDK' : '<!(echo ${CUDA_PATH:-/usr/local/cuda})',
'NVIDA_CUDA_SDK_INCLUDE' : '<(NVIDA_CUDA_SDK)/include',
'NVIDA_CUDA_SDK_LIB' : '<(NVIDA_CUDA_SDK)/lib64',
},
'include_dirs' : [
"<(AMD_OPENCL_SDK_INCLUDE)", "<(NVIDA_CUDA_SDK_INCLUDE)"
],
'library_dirs' : [
"<(AMD_OPENCL_SDK_LIB)", "<(NVIDA_CUDA_SDK_LIB)"
],
'libraries': ['-lOpenCL'],
'cflags_cc': ['-std=c++11', '-Wall', '-O3', '-Wno-ignored-attributes']
}],
['OS=="win"', {
'variables' :
{
# AMD APP SDK
'AMD_OPENCL_SDK' : '<!(echo %AMDAPPSDKROOT%)',
'AMD_OPENCL_SDK_INCLUDE' : '<(AMD_OPENCL_SDK)\\include',
'AMD_OPENCL_SDK_LIB' : '<(AMD_OPENCL_SDK)\\lib\\x86_64',

# Intel OpenCL SDK
'INTEL_OPENCL_SDK' : '<!(echo %INTELOCLSDKROOT%)',
'INTEL_OPENCL_SDK_INCLUDE' : '<(INTEL_OPENCL_SDK)\\include',
'INTEL_OPENCL_SDK_LIB' : '<(INTEL_OPENCL_SDK)\\lib\\x64',

]
# NVIDA CUDA SDK
'NVIDA_CUDA_SDK' : '<!(echo %CUDA_PATH%)',
'NVIDA_CUDA_SDK_INCLUDE' : '<(NVIDA_CUDA_SDK)\\include',
'NVIDA_CUDA_SDK_LIB' : '<(NVIDA_CUDA_SDK)\\lib\\x64',
},
'include_dirs' : [
"<(AMD_OPENCL_SDK_INCLUDE)", "<(INTEL_OPENCL_SDK_INCLUDE)", "<(NVIDA_CUDA_SDK_INCLUDE)","<!(echo %OPENCL_HEADER%)",
],
'library_dirs' : [
"<(AMD_OPENCL_SDK_LIB)", "<(INTEL_OPENCL_SDK_LIB)", "<(NVIDA_CUDA_SDK_LIB)"
],
'defines' : [
# 'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
],
'msvs_settings' : {
'VCCLCompilerTool' : {
'AdditionalOptions' : ['/O2','/Oy','/GL','/GF','/Gm-','/EHsc','/MT','/GS','/Gy','/GR-','/Gd']
},
'VCLinkerTool' : {
'AdditionalOptions' : ['/OPT:REF','/OPT:ICF','/LTCG']
},
},
'libraries': ['OpenCL.lib'],
},
],
]
}]
}
1 change: 1 addition & 0 deletions contracts/ProxyToken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address","name":"_impl","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[],"name":"impl","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]
Loading