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

GPU error with the example #159

Closed
nwalet opened this issue Nov 27, 2023 · 4 comments
Closed

GPU error with the example #159

nwalet opened this issue Nov 27, 2023 · 4 comments

Comments

@nwalet
Copy link

nwalet commented Nov 27, 2023

I have had some real issues with my own custom interactions and CUDA, so I have returned to the standard example (CUDA with LJ and Verlet) from the documentation. That fails as well:

ERROR: LoadError: GPU broadcast resulted in non-concrete element type Union{}.
This probably means that the function you are broadcasting contains an error or type instability.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35

I would hope that would run?
environment:

CUDA.versioninfo()
CUDA runtime 11.8, artifact installation
CUDA driver 12.3
NVIDIA driver 545.23.8

CUDA libraries: 
- CUBLAS: 11.11.3
- CURAND: 10.3.0
- CUFFT: 10.9.0
- CUSOLVER: 11.4.1
- CUSPARSE: 11.7.5
- CUPTI: 18.0.0
- NVML: 12.0.0+545.23.8

Julia packages: 
- CUDA: 4.4.1
- CUDA_Driver_jll: 0.5.0+1
- CUDA_Runtime_jll: 0.6.0+0

Toolchain:
- Julia: 1.9.3
- LLVM: 14.0.6
- PTX ISA support: 3.2, 4.0, 4.1, 4.2, 4.3, 5.0, 6.0, 6.1, 6.3, 6.4, 6.5, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5
- Device capability support: sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86

1 device:
  0: Quadro P400 (sm_61, 1.772 GiB / 2.000 GiB available)

With my own interaction it gets rather worse, and I get messages like
Reason: unsupported call through a literal pointer (call to ijl_alloc_string)
and
Reason: unsupported dynamic function invocation (call to print
but I can probably work those out once I have a working example--feels like some of my "smart" coding doesn't work with CUDA compilation.
Niels

@jgreener64
Copy link
Collaborator

Could you paste the exact example code that you tried? The versions look okay.

@nwalet
Copy link
Author

nwalet commented Nov 27, 2023

using Molly
using CUDA

n_atoms = 100
atom_mass = 10.0f0u"g/mol"
boundary = CubicBoundary(2.0f0u"nm")
temp = 100.0f0u"K"
atoms = CuArray([Atom(mass=atom_mass, σ=0.3f0u"nm", ϵ=0.2f0u"kJ * mol^-1") for i in 1:n_atoms])
coords = CuArray(place_atoms(n_atoms, boundary; min_dist=0.3u"nm"))
velocities = CuArray([random_velocity(atom_mass, temp) for i in 1:n_atoms])
#simulator = VelocityVerlet(dt=0.002f0u"ps")
simulator = NoseHoover(;dt=0.002f0u"ps",temperature="10K",)

sys = System(
    atoms=atoms,
    coords=coords,
    boundary=boundary,
    velocities=velocities,
    pairwise_inters=(LennardJones(),),
    loggers=(
        temp=TemperatureLogger(typeof(1.0f0u"K"), 10),
        coords=CoordinateLogger(typeof(1.0f0u"nm"), 10),
    ),
)

simulate!(deepcopy(sys), simulator, 20) # Compile function
simulate!(sys, simulator, 1_000)

@jgreener64
Copy link
Collaborator

Works for me with the temperature="10K" typo changed to temperature=10u"K".

Could you give your package versions with ]st, the output of versioninfo(), and the full stacktrace?

Does CUDA.jl work for you in general, e.g. is CuArray(rand(3, 3)) .+ CuArray(rand(3, 3)) okay?

@nwalet
Copy link
Author

nwalet commented Nov 28, 2023

Thanks Joe,
That is useful to know--tried it on another computer, and it works there, so clearly the other one needs some additional CUDA goodies installed.
Onwards to debugging my "own" potential.

@nwalet nwalet closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants