FLAMEGPU / FLAMEGPU2

FLAME GPU 2 is a GPU accelerated agent based modelling framework for CUDA C++ and Python
https://flamegpu.com
MIT License
107 stars 22 forks source link

Missing visualisation header files (previously in include/config directory) #1047

Closed DavidFletcherShef closed 1 year ago

DavidFletcherShef commented 1 year ago

While using the c++ tutorial there is a section about visualisation. When trying to use this based in the template FLAMEGPU2-model-template-cpp there is a series of missing include files.

(1) As the tutorial code stands it will generate:

error: namespace "flamegpu::visualiser" has no member "ModelVis" flamegpu::visualiser::ModelVis m_vis = cuda_model.getVisualisation();

(2) The header to include defintion of ModelVis is included by adding the #define right at the top of the code

define FLAMEGPU_VISUALISATION

include "flamegpu/flamegpu.h"

(3) If you do that the error just moves along as this refers to many other files which are not in the FLAMEGPU2 repo. There is a comment in ModelVis.h and other files "// @todo - All vis headers should live in the vis repo." but it looks like they never got there from their previous location.

It appears to relate to this commit in 2021 "Update visualisation includes to use the new directory paths": https://github.com/FLAMEGPU/FLAMEGPU2/tree/ab44f01025528892242de4fb4416660d44d7ac2c

Missing files referred to from /FLAMEGPU2-model-template-cpp-master/build/_deps/flamegpu2-src/include/flamegpu/visualiser/visualiser_api.h

are:

include "flamegpu/visualiser/config/AgentStateConfig.h"

include "flamegpu/visualiser/config/Stock.h"

include "flamegpu/visualiser/config/TexBufferConfig.h"

include "flamegpu/visualiser/config/ModelConfig.h"

include "flamegpu/visualiser/config/LineConfig.h"

I cannot find these anywhere else on the repo so compiling with visualisation is not possible.


Context info: Slackware 15.0, 64 bit gcc 11.2.0 cuda 12.1.66 flamegpu version 2.0.0-rc+19136c1 GPU: Nvidia GeForce GT1030 Driver: Linux x86_64 530.30.02

Robadob commented 1 year ago

You need to enable FLAMEGPU_VISUALISATION at CMake configuration time, this pulls in the separate visualisation library and enables visualisation support (otherwise we'd have problems running on headless systems).

either add -DFLAMEGPU_VISUALISATION=ON to your cmake configure command (if using command line), or tick the box within cmake-gui and click configure, followed by generate.

I'll have a look at the tutorial and see if this could be made clearer.

Edit: Yeah it's not even mentioned, my fault I'll get that resolved.

DavidFletcherShef commented 1 year ago

Fantastic, thanks for the super quick response. I used the cmake command below and now it is working:

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=61 -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc -DFLAMEGPU_VISUALISATION=1

I guess =1 and =ON doesn't matter as the variable just needs to be defined. Thanks for the help.

Robadob commented 1 year ago

I guess =1 and =ON doesn't matter as the variable just needs to be defined. Thanks for the help.

=OFF will disable so it's not that simple, but it seems reasonable that CMake may interpret 1 as ON.

ptheywood commented 1 year ago

=OFF will disable so it's not that simple, but it seems reasonable that CMake may interpret 1 as ON.

It needs to be a CMake value which is truty in CMake's if statements (which is also cmake policy dependent so not super easy to summarise)

https://cmake.org/cmake/help/latest/command/if.html#basic-expressions