chrxh / alien

ALIEN is a CUDA-powered artificial life simulation program.
https://alien-project.org
BSD 3-Clause "New" or "Revised" License
4.85k stars 152 forks source link

Changes needed to build the project on Linux #24

Closed mpersano closed 3 years ago

mpersano commented 3 years ago

Hi, awesome project!

These are the first set of changes I needed to make in order to get the project to build on Linux. I'm also working on making it build with CMake.

Thanks.

chrxh commented 3 years ago

Hi, great! I'm looking forward to seeing your changes! Please give me a signal when you are done :)

r-burns commented 3 years ago

Oops, should have checked here first, I think I independently made a lot of the same changes. Here's a simple cmake setup if you haven't gotten around to that yet: https://github.com/r-burns/alien/commit/7b81a85d2b626060c6dbc84746d5a76196bc8525

mpersano commented 3 years ago

@r-burns just saw your branch, looks like we made the same changes.

Did you get it to run? I got it to build (with a CMake script that's not part of this pull request) and the GUI shows up, but I get this error at runtime:

CUDA error at CudaSimulation.cu:383 code=999(cudaErrorUnknown) "cudaMemcpyToSymbol( cudaSimulationParameters, &parameters, sizeof(SimulationParameters), 0, cudaMemcpyHostToDevice)"

Now I'm wondering if I did something silly or if it's something with my GPU or drivers (I have a GTX 1660 here, so I think it should work).

r-burns commented 3 years ago

Ha, I'm testing this on the same GPU. I was getting a similar error earlier (although I think it was actually a cuda error 700 triggered by a cudaDeviceSynchronize) but now I'm able to run the simulation without issues, so it may not be a deterministic error. I'm just clicking around to place some dots and hitting play though, I'll try to see if I can load one of the more complex examples.

chrxh commented 3 years ago

@mpersano: That line is actually the first CUDA command after initialization. It copies the simulation parameters to the constant memory. Maybe this problem is related to https://stackoverflow.com/questions/58595291/runtime-error-999-when-trying-to-use-cuda-with-pytorch ?

@mpersano, @r-burns : Sorry, that I've currently no contribution guideline so that we can better coordinate our actions in advance. I should create one.

mpersano commented 3 years ago

@chrxh sorry for the late reply. Now it's working on my setup! There was something stupid in the way I was building the CUDA code. Fixed it after looking at @r-burns's CMake script (thanks!).

I've updated the pull request with all the changes I needed including the CMake scripts.

chrxh commented 3 years ago

Good work. I'd like to merge the pull request. On which Linux system did you compile it?

mpersano commented 3 years ago

Great! I built it on Ubuntu 20.04 (note that Ubuntu's standard repositories don't have CUDA Toolkit 11 or Boost 1.75, so I installed those manually).

Also, I get a boost::archive::archive_exception ("incompatible native format - size of long") when trying to load the example simulations. It looks like the boost.serialization binary format is not portable, unfortunately. :(

chrxh commented 3 years ago

In the meantime I'd made a change that causes a few useless bytes not to be serialized in the files. Unfortunately, the examples were no longer compatible and I'd to updated them in the repository. Maybe it is related to this?