rohskopf / modecode

Massively parallel vibrational mode calculator.
22 stars 8 forks source link

Which .cpp code gets run first? #7

Closed kgordiz closed 2 years ago

kgordiz commented 3 years ago

Hello Drew, Hope this is the correct way of raising an issue. I am trying to run the example folder you have in the code: /nfs/aselab001/kgordiz/modecode/examples/Si_8atoms/1_get_modes

I have installed the LAMMPS shared library. I think I have installed ModeCode correctly too (at least it does not give me any error during installation), but still I am getting error (segmentation fault) while running the above example folder using this command: mpirun -np 1 /nfs/aselab001/kgordiz/modecode/src/modecode fd 0.01 2

To learn how ModeCode works, i am adding printf statements to different locations in the mc.cpp and main.cpp codes, but I could not get anything printed. I think something should be printed by printf before the code reaches the error location. Do you know which code gets run (called) first during execution, so I can add the printf command to the beginning of that and start from there? Thanks.

rohskopf commented 3 years ago

Hey Kiarash, please see the README for this example here: https://github.com/rohskopf/modecode/tree/main/examples/Si_8atoms/1_get_modes

We need to supply more arguments: mpirun -np P modecode fd delta cutoff tolerance order

as shown in the main documentation here: https://github.com/rohskopf/modecode

Is there anywhere in the documentation that you saw modecode fd 0.01 2? That's not enough arguments.

Let me know if it works!

rohskopf commented 3 years ago

Here's how the code is organized.

mc.cpp calls other classes (other cpp files) depending on the task you declare (fd, ifc2mcc, compute, etc.).

So mc.cpp gets called first (technically main.cpp is called first, but in main.cpp we just initialize an instance of modecode in mc.cpp).

You'll see how this happens in mc.cpp, in the run() function. There you'll find how different classes are pointed to. For example the "fd" task uses the in-> pointer, the "compute" task uses the compute-> pointer, and so on.

code_architecture

kgordiz commented 3 years ago

Hey Drew, Thank you for the responses and information. I tried running the Si_8atoms example again with the line

mpirun -np 1 modecode fd 0.001 3.0 2

that you mentioned, which is the first command in the ReadMe file in the folder _Si_8atoms/1_getmodes as you said. I am still getting the segmentation fault in the _Si8atoms example folder. Previously, I was running the command on the headnode, but I now submitted it as a job. The cluster is busy now, but I will update on how it goes and if the calculation gets run.

Also, the command

mpirun -np 2 modecode fd 0.01 2

or as I said without mpirun

modecode fd 0.01 2

is in the ReadMe file on the main page (https://github.com/rohskopf/modecode). It is at the beginning of the Tutorial: Crystalline silicon section.

rohskopf commented 3 years ago

the ReadMe file on the main page (https://github.com/rohskopf/modecode). It is at the beginning of the Tutorial: Crystalline silicon section.

Oh thanks, I updated that section. All examples have their own READMEs in their respective folders. Try this command:

mpirun -np 4 modecode fd 0.001 3.0 1e-8 2 > outfile_ifc2

which is explained in the README here.

If you do mpirun -np 1 modecode fd 0.001 3.0 2 then you're missing the required tolerance setting, which ignores FCs below a certain magnitude. The segfault is because the program is trying to access an argument that's not there, since you're missing an argument.