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

CUDA: invalid device function #1173

Closed
ibaned opened this issue Oct 18, 2017 · 1 comment
Closed

CUDA: invalid device function #1173

ibaned opened this issue Oct 18, 2017 · 1 comment
Labels
Question For Kokkos internal and external contributors and users

Comments

@ibaned
Copy link
Contributor

ibaned commented Oct 18, 2017

I'm having a hard time tracking down what is causing this in our application, so this issue is really just created in the hopes that another Kokkos dev recognizes this error and remembers some known cause of it...
If I figure this out I'll post what I find out here, and hopefully propose an additional safety check to Kokkos to cause a more intuitive error.

  cudaFuncSetCacheConfig( cuda_parallel_launch_local_memory< DriverType, LaunchBounds::maxTperB, LaunchBounds::minBperSM > , cudaFuncCachePreferL1 ) error( cudaErrorInvalidDeviceFunction): invalid device function /home/daibane/ride/install/Trilinos/include/Cuda/Kokkos_CudaExec.hpp:262
@ibaned ibaned added the Question For Kokkos internal and external contributors and users label Oct 18, 2017
@ibaned
Copy link
Contributor Author

ibaned commented Oct 25, 2017

We think this was the consequence of what I'll call a use-after-scope bug. Below is an example of what that means:

#include <iostream>

struct Data {
  Data(double in) : value(in) {}
  double value;
};

struct Class {
  Data* ptr;
  Class(Data &ref) : ptr(&ref) {}
  void foo() { std::cout << ptr->value << '\n'; }
};

static Class make_thing(double in) {
  Data local_data(in);
  return Class(local_data);
}

int main() {
  auto thing = make_thing(42.0);
  thing.foo();
}

Its quite hard to detect... anyway, not a Kokkos issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question For Kokkos internal and external contributors and users
Projects
None yet
Development

No branches or pull requests

1 participant