Peculiar behavior with Pkg.test

Unfortunately, I’m going to have to describe my problem in pretty general terms; I don’t know of a simple way of inducing it, and it’s not practical to include the actual code involved. I have a package that I’m writing unit tests for. Among other things, it uses CUDA for some of its computations. I’m finding that if I’m in the Pkg environment and launch the unit tests using test, CUDA throws an exception (throw_api_error - not especially illuminating to me). If, however, I set up a script that uses the same packages, data, calling sequences, etc. it sails through without the exception. If, from the REPL, I type include("runtests.jl"), the tests all pass and no exception is thrown. Any suggestions as to what might be going on?

Pkg.test run with bounds checking forced on by default. Not sure that is the issue here but you could try start julia with --check-bounds=yes and see if that reproduces the problem.

Thank you - that’s a helpful insight. I just tried running my example with --check-bounds=yes and didn’t see the exception get thrown. Sigh. The hunt continues…

The code where the exception originates does have a block bounded by an @inbounds macro, so I’m going to focus my attention there.

I was able to pass --check-bounds=no to Pkg.test() and no CUDA exception got thrown. So, thanks again!

1 Like