DEM-Egnine-installation

501 views
Skip to first unread message

Weigang Shen

unread,
May 6, 2024, 8:37:47 PM5/6/24
to ProjectChrono
Hello everyone,

When i build the c++ DEME, there is an error as shown in the figure below.

Coould anyone give me a help?

Thanks!微信图片_20240507083122.jpg

Ruochun Zhang

unread,
May 7, 2024, 4:50:27 AM5/7/24
to ProjectChrono
Hi Dr. Shen,

A couple of questions: What is your cmake version, what is your CUDA version, and what model is the GPU you have on your system?

Thank you,
Ruochun

Weigang Shen

unread,
May 7, 2024, 5:23:14 AM5/7/24
to ProjectChrono
Hi Dr. Zhang:

The versions of cmake and cuda, and the model of GPU are shown below.

Thank you!
微信图片_20240507171644.jpg

Ruochun Zhang

unread,
May 7, 2024, 6:12:11 AM5/7/24
to ProjectChrono
Looks all good. Please show your ccmake GUI when configuring the project: You may see in there a few missing items that the autodetection failed to identify. Could be CUDA_ARCHITECTURES or CUDA_PATH related.
If this is the case, then we may help you fill them out manually.

Ruochun

Weigang Shen

unread,
May 7, 2024, 7:14:18 AM5/7/24
to ProjectChrono
The ccmake GUI and the configure error are shown below. I do not see anything related to  CUDA_ARCHITECTURES or CUDA_PATH.
微信图片_20240507191053.jpg 微信图片_20240507191047.jpg

Ruochun Zhang

unread,
May 7, 2024, 8:20:57 AM5/7/24
to ProjectChrono
Doesn't look like it finds a CUDA compiler at all. It appears that /usr/bin is checked but it's not found there. Please make sure your CUDA installation is in PATH. Maybe the troubleshooting part of this section of DEME manual can help you.

Thank you,
Ruochun

Weigang Shen

unread,
May 8, 2024, 5:16:58 AM5/8/24
to ProjectChrono
Hi Dr. Zhang,

I still encountered a error like this. Do you have any suggestion?

Thanks!
a391d46ae4497f81bd18b7e111b4842.jpg

Ruochun Zhang

unread,
May 8, 2024, 3:36:40 PM5/8/24
to ProjectChrono
It looks like it found the compiler nvcc this time, but it's not working correctly... How did you make it find nvcc in /usr/bin this time? I thought you had nvcc in another location last time. You re-installed? And can you show the ccmake GUI this time as well?

Ruochun

Weigang Shen

unread,
May 8, 2024, 10:11:05 PM5/8/24
to ProjectChrono
I updated the cmake from 3.20 to 3.29, which made it find the nvcc. However, the ccmake GUI is empty now.
微信图片_20240509100541.jpg

Ruochun Zhang

unread,
May 9, 2024, 2:27:59 AM5/9/24
to ProjectChrono
Can you please press c to configure the project, so we might know what is still missing for the project? If nothing goes wrong, then try pressing g to generate the project.

Thank you,
Ruochun

Weigang Shen

unread,
May 9, 2024, 4:54:34 AM5/9/24
to ProjectChrono
After press c to configure, there is also an error like this:
5c8b56934e5f50fa728c05edc5b5ffd.jpg

Ruochun Zhang

unread,
May 9, 2024, 7:08:28 AM5/9/24
to ProjectChrono
To me, because CMakeCUDACompilerId.cu is a Cmake-generated minimal example and it failed to compile, it looks like the compiler is not configured properly and cannot compile anything. The solution is probably case-by-case. I am not familiar with the installation process of CUDA enough to accurately remote-diagnose (but someone else here might be). The best you can do is to write a minimal CUDA example, test if it can be compiled, and debug starting from there. However, I have a couple of guesses...
1. If you installed CUDA multiple times or had multiple trials (like once from apt-get and then another time from a downloaded file), there can be conflicts. The nvcc in /usr/bin might be a symbolic link, and it could be linked against an executable that is not compatible with the CUDA toolkit. You might try to fix this symbolic link by linking it against that one in cuda-12.0/bin, or the one you think is correct.
2. Just remove all installation of CUDA and start over.
3. I don't know the GCC or Clang version you are using. It's not likely, but it might be too old or too new to be compatible with nvcc. GCC 9.4 should be a version that works in most of my trials, in case you wish to give it a try.

That is all I can think of at this point, thank you,
Ruochun

Weigang Shen

unread,
May 9, 2024, 9:11:52 PM5/9/24
to ProjectChrono
Hi Ruochun,
I have succefully configured the DEME after the reinstallation of CUDA. Thank you! It is indeed that the  multiple times installation of CUDA induced the previours error. 
When I run the demo, there is an error like this. Do you have any suggestion?
微信图片_20240510091101.jpg

Ruochun Zhang

unread,
May 10, 2024, 3:06:30 AM5/10/24
to ProjectChrono
Yes. This error was encountered during a cudaGetDeviceCount call, which is the first GPU-related call when constructing a DEME simulation object. So CUDA failed to get the number of devices. I don't know if you've been having success running GPU-based applications on this machine but again, I suspect it can't run anything GPU-related, not limited to DEME. Possible treatments include...
1. The NVIDIA driver installed on your system is not compatible with CUDA 12.0, or is corrupted. You probably want to ensure a correct installation of a GPU driver first, if you haven't paid attention to doing that.
2. You may want to check using nvidia-smi to see if the OS recognizes the GPU at all.
3. You should ensure that you have the permissions needed to access GPUs.

In short, ensure you have GPU access. It's still good to start from a minimal CUDA example to debug, since it appears to be a basic environmental issue.

Thank you,
Ruochun

Weigang Shen

unread,
May 13, 2024, 4:17:01 AM5/13/24
to ProjectChrono
Hi Ruochun,
After the reboot of my computer, the demo runs successfully. Thank you for your careful help!

Ruochun Zhang

unread,
May 13, 2024, 4:23:57 AM5/13/24
to ProjectChrono
Oh right... Rebooting might be needed for completing the CUDA installation, I forgot...

Now you should be able to install pyDEME too, since the installation environment issue is resolved.

Thank you,
Ruochun

Weigang Shen

unread,
May 14, 2024, 1:52:27 AM5/14/24
to ProjectChrono
Hi Ruochun,

Thank you for your help again! I would like to ask some questions about the output data of dem-engine.
1. how to output a vtk file in which i would like to contain the position, radius, velocity and resultant force of particles.
2. how to output the energy dissipation, such as the energy dissipated by the interparticle friction and damping.
3. how to output the interparticle force which  i would like to use to plot force chain.

Thank you!

Ruochun Zhang

unread,
May 14, 2024, 2:18:01 PM5/14/24
to ProjectChrono
Hi Dr. Shen,

1. I haven't added direct vtk output for sphere/clump information. They are now written in csv format. But you can use your own tool to convert csv to vtk. The information you need is all there. You can specify what goes into the output file by calling the method SetOutputContent like the following
DEMSim.SetOutputContent({"VEL", "ACC"});

2. Again, this is something you can derive from the simulation status, but DEME does not have a one-liner to compute that. You can compute the kinetic energy through the linear and angular velocities of each particle, and compute the potential through the positions of each particle at different points in time. The information can all be queried through trackers. For the kinetic energy though, there is a convenient call to compute that which is through inspectors
auto KE_finder = DEMSim.CreateInspector("clump_kinetic_energy");
You can find this example in the demo SingleSphereCollide.

However, if you also need to know respectively the contribution of friction and damping, this is more complex, and you need to write a custom force model that records this information. This is an advanced usage and a bit more challenging. I also find this not that meaningful in many real-world DEM applications because the damping and friction coefficients can be very heuristic anyway.

3. This can be written to a contact file. The method to use is WriteContactFile. An example can be found in the demo GRCPrep_Part1 or 2 or 3. You should also specify what goes into those contact files by calling SetContactOutputContent. An example...
DEMSim.SetContactOutputContent({"OWNER", "FORCE", "POINT", "COMPONENT", "NORMAL", "TORQUE"});

If you have specific questions regarding using the methods, feel free to ask.

Thank you,
Ruochun

Weigang Shen

unread,
May 15, 2024, 4:59:37 AM5/15/24
to ProjectChrono
Hi Ruochun:

Thank you for your reply! 
When i run the demo 'DEMdemoFractureBox', the runtime inerface is always like the figure below all the time. There is nothing outputed.
Do you have any suggestion?
微信图片_20240515165515.jpg

Ruochun Zhang

unread,
May 15, 2024, 5:36:47 AM5/15/24
to ProjectChrono
Most of the demos are quite large. This one particularly uses a fine step size and depending on the hardware, it may take hours or days. I suggest you wait longer. Or you can try out some other demos that I have explanations for on the Git page.

You don't necessarily need to run them. Just have a look at how the methods I mentioned in the previous post are used in these demos to get an idea on how you can use them.

If you just want to know what a contact file may look like, then I happen to have one stored in data/sim_data/example_cnt_pairs.csv.

Thank you,
Ruochun

Weigang Shen

unread,
May 16, 2024, 5:11:22 AM5/16/24
to ProjectChrono
Hi Ruochun,

Thank you for your reply! The reason why i tryed to run the DEMdemoFractureBox demo is that i would like to model rock breakage in my case. From your paper published in Computer Physics Communications, i noticed that you have achieved the uniaxial compression test of rock. Could you share the code with us?

By the way, i have three questions needing your help.
(1) For my case, i would like to model the sliding and framentation of many rock blocks. So, how to generate a assembly of brakeable rock blcoks? In particular, how to generate a irregular shaped rock block which consists of sphere elements?

(2) If we finished our own code, where and how to generate a executable code?

(3) If we modified the DEM-Engine source code, such as if we add a force model, how to reconfigure the DEM-Engine?

Thank you,
Weigang

Ruochun Zhang

unread,
May 17, 2024, 4:32:41 PM5/17/24
to ProjectChrono
About the rock breakage test we gave in the paper, it should be exactly that demo: Fracture_Box. Run it and it should give you what we had in the paper.

To answer your other questions...
1. This is not strictly a DEME question, nor an easy one necessarily. DEME only cares about the position and radius of the initial spheres, and how you generate them is in itself a research problem that you have to solve yourself. It's even more complex considering it's not just about filling a volume represented by a mesh, but you need the interior spheres' overlapping pattern to become an appropriate apparatus for representing the initial internal force. I might have read about some other people's elegant solutions but they are not off the top of my head. If I were to do it, I'd probably write a script that uses planes to intersect the mesh of the rock, then fill the intersection with spheres until the volume is completely filled layer by layer.

2. The rest are CMake questions. For now, if you just wish to easily compile your own script and without worrying about the potential co-simulations, then adding a demo is fine. Put the script in the demo folder, add its name to the CMakeList.txt in the demo folder, and then recompile (make or ninja) the project.

3. Same as above. Note that modifying and supplying a custom force model does not necessarily require you to rebuild the project, if the custom model is loaded from a file. When the executable is run, the content of that file will be read and executed, so simply modifying that file and then run the executable is fine. This however, applies to a force model file located in a location that you know and control (you may want to supply the full path to that file in your script), not the force model files in the source code! The ones in the source code are not read when a demo is run, as the solver reads the files in the build folder by default, or whatever location you tell it to read. If you supply your force model with a string in the demo itself like I did in an example, then obviously you have to recompile the project every time you modify that demo script.

I'd also appreciate it if you post a new thread to ask further questions, since the discussion has moved well beyond what the title suggests already.

Thank you,
Ruochun

Weigang Shen

unread,
May 20, 2024, 12:42:41 AM5/20/24
to ProjectChrono
Hi Ruochun,

Thank you for your reply! I will post a new thread to discuss the pre and post processing for DEM-Engine.

Weigang Shen

unread,
Sep 26, 2024, 7:11:06 AM9/26/24
to ProjectChrono
Hi Ruochun,
I am now trying to install dem-engine on ubuntu 18.04. I encountered a problem as shown below. The cmake version is 3.29, but the error indicated that i am running version 3.10.
Could you give me a help?微信图片_20240926182605.jpg

Radu Serban

unread,
Sep 26, 2024, 8:10:26 AM9/26/24
to ProjectChrono

You are definitely running CMake 3.10.2 (look at the bottom right of ccmake).

Make sure you have correctly installed CMake 3.29.  You may want to uninstall CMake 3.10.2.

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of Weigang Shen
Sent: Thursday, September 26, 2024 12:32 PM
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Re: DEM-Egnine-installation

 

Hi Ruochun,

I am now trying to install dem-engine on ubuntu 18.04. I encountered a problem as shown below. The cmake version is 3.29, but the error indicated that i am running version 3.10.

Could you give me a help?

 

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/5c82204e-fbb4-47c4-b778-dad7c9132fb9n%40googlegroups.com.

Weigang Shen

unread,
Sep 27, 2024, 7:41:23 AM9/27/24
to ProjectChrono
Actually, i have installed cmake 3.29.3. However, it still has such a problem.

微信图片_20240927193903.jpg

Ruochun Zhang

unread,
Sep 27, 2024, 8:00:36 AM9/27/24
to ProjectChrono
Then did you also install ccmake using apt-get?

Ruochun

Weigang Shen

unread,
Sep 27, 2024, 8:07:20 AM9/27/24
to ProjectChrono
Yes, i installed cmake 3.10 using apt-get. I would like to uninstall cmake 3.10 now. But, it seems that cmake 3.10 can not be uninstalled completely.  
微信图片_20240927200329.jpg

Ruochun Zhang

unread,
Sep 27, 2024, 12:09:08 PM9/27/24
to ProjectChrono
Sometimes cmake or cmake-curses-gui you get from apt-get has weird versions, I think I encountered that before too. As suggested in DEME's readme document, you could try the method on this page to see if it helps. It says it's for WSL but should work on your Linux machine too.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 7, 2024, 10:31:11 PM10/7/24
to ProjectChrono
Hi Ruochun,

Thank you for your reply!  Via the method on that page, I have installed cmake-3.25 succeffully. I now found that there is no nvcc in usr/bin. Do you have any idea about this?

Thank you,
Weigang

Weigang Shen

unread,
Oct 8, 2024, 10:16:04 PM10/8/24
to ProjectChrono
Hi Ruochun,

I am now encountering such a problem. Could you give me a help?
微信图片_20241009101157.jpg

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 9, 2024, 9:46:36 PM10/9/24
to ProjectChrono
You are probably using an old GCC version, as you'll need a C++17-compatible compiler. You may use GCC 8 or newer.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 9, 2024, 10:53:23 PM10/9/24
to ProjectChrono
Thank you! This problem has been solved. However, there is a new error as shown below.
微信图片_20241010105032.jpg

Thank you,
Weigang

Weigang Shen

unread,
Oct 10, 2024, 1:33:06 AM10/10/24
to ProjectChrono
when i run the demo, there is also a error as shown below.
微信图片_20241010132851.jpg

Ruochun Zhang

unread,
Oct 10, 2024, 8:40:09 AM10/10/24
to ProjectChrono
The previous one appears to be a linkage problem with filesystem-related libraries. If your compiler supports C++17, then I suggest you remove everything in your build folder and try rebuilding, and in the ccmake configuration, manually set the C++ standard to 17. If this does not help then maybe there is a problem with your compiler installation...

As for the bad_alloc thing, it is usually a failed memory allocation attempt. Since this demo is small in scale, it is more likely due to that you have no GPU devices/GPU devices not accessible by the system/no proper GPU driver or CUDA runtime installation.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 10, 2024, 11:10:55 PM10/10/24
to ProjectChrono
I think that i have the GPU devices and GPU driver. If the reason is that the  GPU devices not accessible by the system, how can i solve this problem? Do you have any suggestion? By the way, i would like to know that what is the meaning of CUDA runtime installation.

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 10, 2024, 11:26:54 PM10/10/24
to ProjectChrono
Then to understand how/if it is related to your device, it's best to test if we can use it to do something else. I'm just giving an example: you can use your nvcc compiler to compile the attached script. If it works then it's probably not your device, and if it gives an error you know where the problem is. And if your device works all right, we have to know where the bad_alloc happened to proceed.

Also, by that, I just meant the installation of CUDA might be the issue.

Thank you,
Ruochun

get_device_info.cpp

Weigang Shen

unread,
Oct 11, 2024, 12:52:41 AM10/11/24
to ProjectChrono
I have run the attached script. it runs well. 
微信图片_20241011125001.jpg

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 11, 2024, 2:38:27 AM10/11/24
to ProjectChrono
If the device is not the problem and the demo exits quickly after starting, that's a bit weird. Could you check two things: 1) Provided that you can build the entire project, check if this is also the case for other demos; 2) Step into the demo (perhaps using VSCode and gdb as the debugger) and see where this happens. You probably don't need to go very deep since it appears bad_alloc happened quickly after running. But you may need to rebuild the project using Debug (not Release) build option before you do this.

I'd also like to note right now DEME does not work on WSL so please make sure you are not doing this on WSL. But it looks like this is a native Linux machine so perhaps no issue here.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 11, 2024, 3:51:05 AM10/11/24
to ProjectChrono
I have test all the demo. This error is universal for all the demos. I have presented two figures below. For the first figure, i would like use it to confirm whether i complied the DEM-Engine succefully. For the second figure, i would like use it to confirm whether i have found where the bad_alloc happened.
微信图片_20241011154510.jpg   微信图片_20241011154519.jpg

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 11, 2024, 11:23:51 PM10/11/24
to ProjectChrono
For the debugging part, not quite yet. It still just says it bad_allocs out. If you could, try interfacing the debugger with some GUI, like VSCode, then stepping into it until it fails, and let us know which line it failed on. 

You can also get more info on memory-related failures by running the demo in valgrind or cuda-memcheck or something like them, for example valgrind --tool=memcheck ./DEMdemo_SingleSphereCollide, and/or cuda-memcheck  ./DEMdemo_SingleSphereCollide.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 14, 2024, 6:58:52 AM10/14/24
to ProjectChrono
I have try my best to debug. I do not know whether i have found where the error failed on. 
微信图片_20241014185545.jpg

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 15, 2024, 9:47:07 AM10/15/24
to ProjectChrono
As you can see, those are compilation errors. Can you compile the code at all? Have the previous filesystem-related inclusion and dynamic linkage problems been resolved, and how?

If you can compile the code, then you can debug it by configuring the launch.json file in VSCode, then step into the code line by line. For how to do that, I suggest searching and reading some online tutorials on this topic and it should be easy from there.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 16, 2024, 12:34:36 AM10/16/24
to ProjectChrono
In fact, the code has been successfully compiled.  The previous filesystem-related inclusion and dynamic linkage problems are resolved by  changing CMAKE_BUILD_TYPE to Release.
I am not familar with using vscode to debug. So, I have an question about the debuging process. Do you mean that i should debug the dem-engine code, or just the demo?

Thank you,
Weigang

Ruochun Zhang

unread,
Oct 16, 2024, 10:09:13 AM10/16/24
to ProjectChrono
Changing the build type should not have any impact on whether the code compiles... You probably did something else in addition to that such as updating the compiler. You should first make sure the code compiles now.

You just need to debug a demo. When running the debugger, the classes and methods being used will be stepped into and then you know where it crashes.

Thank you,
Ruochun

Weigang Shen

unread,
Oct 17, 2024, 4:10:19 AM10/17/24
to ProjectChrono
According to the complication method on GitHub - projectchrono/DEM-Engine: A dual-GPU DEM solver with complex grain geometry support, after using ninja to build the project, I got a information like the figure shown below. Does it means that I have complied the code?
微信图片_20241011154510.jpg
Thank you,
Weigang

Ruochun Zhang

unread,
Oct 17, 2024, 10:39:09 AM10/17/24
to ProjectChrono
Yes, it appears that the code has been compiled without errors. If the executables of the demos are generated it usually indicates that.

Thank you,
Ruochun

Reply all
Reply to author
Forward
0 new messages