antonmks / Alenka

GPU database engine
Other
1.17k stars 120 forks source link

mgpu::cuda_exception_t "Invalid device function" exception #99

Closed marklit closed 8 years ago

marklit commented 8 years ago

Hi,

I'm running a Nvidia GTX 1080 on Ubuntu 16.04 64-bit, CUDA 8 and the 367.48 driver. I'm trying to compile Alenka but I'm getting the following error when I run the executable after it's been compiled...

$ src/alenka
terminate called after throwing an instance of 'mgpu::cuda_exception_t'
  what():  invalid device function
Aborted (core dumped)

The moderngpu library looks to be working so I'm not sure why it's throwing an exception. Below are the steps I took to compile Alenka:

$ git clone https://github.com/antonmks/Alenka.git ~/Alenka
$ cd ~/Alenka
$ git checkout development
$ git submodule init
$ git submodule update

$ cd deps/moderngpu
$ make

I then tested the moderngpu library:

$ mkdir ~/testing
$ cd ~/testing
$ vi hello.cu
#include <moderngpu/transform.hxx>

using namespace mgpu;

int main(int argc, char** argv) {
  // The context encapsulates things like an allocator and a stream.
  // By default it prints device info to the console.
  standard_context_t context;

  // Launch five threads to greet us.
  transform([]MGPU_DEVICE(int index) {
    printf("Hello GPU from thread %d\n", index);
  }, 5, context);

  // Synchronize on the context's stream to send the output to the console.
  context.synchronize();

  return 0;
}
$ nvcc \
    -std=c++11 \
    --expt-extended-lambda \
    -gencode arch=compute_50,code=compute_50 \
    -I ../Alenka/deps/moderngpu/src/ \
    -o hello \
    hello.cu

$ ./hello
GeForce GTX 1080 : 1835.000 Mhz   (Ordinal 0)
20 SMs enabled. Compute Capability sm_61
FreeMem:   6678MB   TotalMem:   8110MB   64-bit pointers.
Mem Clock: 5005.000 Mhz x 256 bits   (320.3 GB/s)
ECC Disabled

Hello GPU from thread 0
Hello GPU from thread 1
Hello GPU from thread 2
Hello GPU from thread 3
Hello GPU from thread 4

I then altered the Makefile to support all levels of compute compatibility listed for Alenka:

$ cd ~/Alenka
$ vi src/Makefile
GENCODE_SM30   := -gencode arch=compute_30,code=sm_30
GENCODE_SM35   := -gencode arch=compute_35,code=sm_35
GENCODE_SM50    := -gencode arch=compute_50,code=sm_50

I then ran make:

$ make

As soon as that was done I ran the Alenka binary and got the exception.

$ src/alenka
terminate called after throwing an instance of 'mgpu::cuda_exception_t'
  what():  invalid device function
Aborted (core dumped)

I've also tried with just the following uncommented:

GENCODE_SM30   := -gencode arch=compute_30,code=sm_30

and with just this uncommented:

GENCODE_SM50    := -gencode arch=compute_50,code=sm_50

But neither of them worked either.

I did try with CUDA 7.5 but came up against malloc-related errors.

Any ideas how I can compile Alenka properly?

Thanks, Mark

antonmks commented 8 years ago

I'll see if I can replicate it, but I do not have 1080. Have you tried to compile it with GENCODE_SM61 := -gencode arch=compute_61,code=sm_61 ? Seems like your card supports compute model 6.1

marklit commented 8 years ago

I'll certainly give that a try and report back with my findings.

marklit commented 8 years ago

I've compiled Alenka using the following:

#compute compatibility (https://developer.nvidia.com/cuda-gpus)
# GENCODE_SM30  := -gencode arch=compute_30,code=sm_30
# GENCODE_SM35  := -gencode arch=compute_35,code=sm_35
# GENCODE_SM50  := -gencode arch=compute_50,code=sm_50
GENCODE_SM61    := -gencode arch=compute_61,code=sm_61
GENCODE_FLAGS   := $(GENCODE_SM30) $(GENCODE_SM35) $(GENCODE_SM50) $(GENCODE_SM61)

And I get the following when I run the binary:

$ make clean
$ make -j4
$ src/alenka
$ src/alenka 
GeForce GTX 1080 : 1835.000 Mhz   (Ordinal 0)
20 SMs enabled. Compute Capability sm_61
FreeMem:   6729MB   TotalMem:   8113MB   64-bit pointers.
Mem Clock: 5005.000 Mhz x 256 bits   (320.3 GB/s)
ECC Disabled

Usage : alenka [--QPS-test] | [ [-l load size(MB)] [-v] script.sql ]

So it looks like it's working. Thank you very much.

antonmks commented 8 years ago

Are you planning to run alenka on taxi rides dataset ? Please let me know if you need any help.

marklit commented 8 years ago

I am and any help would be greatly appreciated.

Feel free to drop me an email at some point, it would be good to chat about your project.

antonmks commented 8 years ago

Please don't use development branch, it was a part of a different project.It is not working currently. Use main version, it should work fine. Looks like your data are not loaded. I tested it with the main branch version and it worked fine.

On Sun, Oct 16, 2016 at 1:52 PM, Mark Litwintschik <notifications@github.com

wrote:

I am and any help would be greatly appreciated.

Feel free to drop me an email at some point, it would be good to chat about your project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/antonmks/Alenka/issues/99#issuecomment-254039890, or mute the thread https://github.com/notifications/unsubscribe-auth/ABhkFF85tCo54iT8_2_OGKUa2GSM5e2wks5q0gHigaJpZM4KR0z_ .