BioDynaMo / biodynamo

BioDynaMo is a high-performance and modular, agent-based simulation platform.
Apache License 2.0
101 stars 46 forks source link

Building and running GPU code #344

Closed UmarAbubacar closed 12 months ago

UmarAbubacar commented 1 year ago

I am trying to use the GPU acceleration code however when I try to build with the Dcuda=ON flag I first get errors for the path to "/samples/common/inc/helper_math.h". After I update this path in the CMakeLists.txt (line:634) to where the file is located on my computer, I get errors for missing files from the file: src/core/gpu/mechanical_forces_op_cuda_kernel.cu on line:

#include "core/gpu/helper_math_real_t.h"

When I replace the file with what I think it should be #include "core/gpu/helper_math_double.h" I then get errors saying real_t not defined.

I am not sure if I need a specific version of the source code or a specific version of cuda. I am using the master branch on Ubuntu 22.04 and I have cuda version:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0 

I tried to use the version of biodynamo mentioned in the paper https://arxiv.org/pdf/2105.00039.pdf but that also resulted in errors.

TobiasDuswald commented 1 year ago

The GPU code is not tested in our CI, it's not unlikely that things break every now and then. I personally do not have access to a GPU machine so I have never used it.

It seems though as if the real_t broke it judging from your errors. So you might want to try commit cebe047f81398dacf3e687aa06dee96c654650da which is right before the introduction of real_t but, unfortunately, ubuntu22 was not yet supported at that time. You may have to somehow add commit d1dc64eed1835bfbcc8d23bd93d638a0fe14455a to add ubuntu 22.04 support.

Other than that, debugging the build and submitting a PR for it would be great.

The GPU code was done by @Senui , maybe he can help with the issue. :)

TobiasDuswald commented 1 year ago

@UmarAbubacar did you manage to get that running?

UmarAbubacar commented 12 months ago

@TobiasDuswald I managed to get it running with some changes but I quickly stopped using it as my simulations required non-spherical agents. The version I was testing with was master at the time. I think this code being experimental naturally requires some more effort to get it working.