johguse / profanity

Vanity address generator for Ethereum
834 stars 324 forks source link

std::runtime_error - failed to create kernel "profanity_init" #51

Open SmartLayer opened 3 years ago

SmartLayer commented 3 years ago

Dowload the precompiled profanity, it works fine, but self-compiled ones didn't:

Downloaded binary

$ ls /opt/profanity/
cache-opencl.255.131072  keccak.cl  profanity.cl  profanity.exe  profanity.x64
$ ./profanity.x64 --contract --leading 0
Mode: leading
Target: Contract
Devices:
  GPU0: GeForce RTX 2070 SUPER, 8368685056 bytes available, 40 compute units (precompiled = yes)

Initializing OpenCL...
  Creating context...OK
  Loading kernel from binary...OK
  Building program...OK

Initializing devices...
  This should take less than a minute. The number of objects initialized on each
  device is equal to inverse-size * inverse-multiple. To lower
  initialization time (and memory footprint) I suggest lowering the
  inverse-multiple first. You can do this via the -I switch. Do note that
  this might negatively impact your performance.

  Time:     4s Score:  6 Private: 0x6dcc6899b87ba18be41132538f6389f483b6c5290bae53c6a7047a0c934a85d7 Contract: 0x000000908fc0063710a6b5089e6921a0f020479a

Self-compiled:

$ sudo apt install nvidia-opencl-dev  ocl-icd-opencl-dev opencl-headers
$ make
g++ -c -std=c++11 -Wall -mmmx -O2 -mcmodel=large   Dispatcher.cpp -o Dispatcher.o
In file included from /usr/include/CL/cl.h:32,
                 from Dispatcher.hpp:14,
                 from Dispatcher.cpp:1:
/usr/include/CL/cl_version.h:34:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |                                                                                                        ^
Dispatcher.cpp: In static member function ‘static _cl_command_queue* Dispatcher::Device::createQueue(_cl_context*&, _cl_device_id*&)’:
Dispatcher.cpp:84:34: warning: converting to non-pointer type ‘cl_command_queue_properties’ {aka ‘long unsigned int’} from NULL [-Wconversion-null]
   84 |  cl_command_queue_properties p = NULL;
      |                                  ^~~~
Dispatcher.cpp: In member function ‘void Dispatcher::addDevice(cl_device_id, size_t, size_t)’:
Dispatcher.cpp:165:113: warning: ‘new’ of type ‘Dispatcher::Device’ with extended alignment 32 [-Waligned-new=]
  165 |  Device * pDevice = new Device(*this, m_clContext, m_clProgram, clDeviceId, worksizeLocal, m_size, index, m_mode);
      |                                                                                                                 ^
Dispatcher.cpp:165:113: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
Dispatcher.cpp:165:113: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
Dispatcher.cpp: In function ‘void printResult(cl_ulong4, cl_ulong, result, cl_uchar, const std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >&, const Mode&)’:
Dispatcher.cpp:29:13: note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
   29 | static void printResult(cl_ulong4 seed, cl_ulong round, result r, cl_uchar score, const std::chrono::time_point<std::chrono::steady_clock> & timeStart, const Mode & mode) {
      |             ^~~~~~~~~~~
g++ -c -std=c++11 -Wall -mmmx -O2 -mcmodel=large   Mode.cpp -o Mode.o
In file included from /usr/include/CL/cl.h:32,
                 from Mode.hpp:9,
                 from Mode.cpp:1:
/usr/include/CL/cl_version.h:34:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |                                                                                                        ^
g++ -c -std=c++11 -Wall -mmmx -O2 -mcmodel=large   precomp.cpp -o precomp.o
In file included from /usr/include/CL/cl.h:32,
                 from types.hpp:10,
                 from precomp.hpp:4,
                 from precomp.cpp:1:
/usr/include/CL/cl_version.h:34:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |                                                                                                        ^
g++ -c -std=c++11 -Wall -mmmx -O2 -mcmodel=large   profanity.cpp -o profanity.o
In file included from /usr/include/CL/cl.h:32,
                 from profanity.cpp:16:
/usr/include/CL/cl_version.h:34:104: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
      |                                                                                                        ^
g++ -c -std=c++11 -Wall -mmmx -O2 -mcmodel=large   SpeedSample.cpp -o SpeedSample.o
g++ Dispatcher.o Mode.o precomp.o profanity.o SpeedSample.o -s -lOpenCL -mcmodel=large -o profanity.x64
$ ./profanity.x64 --contract --leading 0
Mode: leading
Target: Contract
Devices:
  GPU0: GeForce RTX 2070 SUPER, 8368685056 bytes available, 40 compute units (precompiled = yes)

Initializing OpenCL...
  Creating context...OK
  Loading kernel from binary...OK
  Building program...OK

std::runtime_error - failed to create kernel "profanity_init"
Incrediblez7 commented 3 years ago

Encountered exact same issue on Windows 10, but on precompiled.

MasonBarnes commented 3 years ago

Encountered exact same issue on Windows 10, but on precompiled.

Make sure you're running it in an administrator command prompt