openfast icon indicating copy to clipboard operation
openfast copied to clipboard

Can I run OpenFAST in debug mode?

Open skpal-1 opened this issue 9 months ago • 8 comments

Hello all,

I need to understand the detailed workflow of OpenFAST, therefore wish to run in Debug mode in visual studio. Is it possible ? I could successfully compile in my windows PC, however, not sure which is the main file.

If there is any previous post, could you paste the link in comment please?

Regards,

skpal-1 avatar Apr 04 '25 15:04 skpal-1

Yes, you can run OpenFAST in debug in Visual Studio by opening the FAST solution file and selecting the FAST project as the Startup Program. Then, you will need to open the project settings and fill out the Command Arguments and Working Directory with the input file name and directory. Then, click the Start button in Visual Studio to run the program.

deslaughter avatar Apr 08 '25 17:04 deslaughter

@deslaughter Thank you for the help. As you suggested I did the following:

  1. "Set as Startup Project" Image

  2. I could not find the project settings so I assumed you meant right click on FAST (IFORT) > Properties.

Image 3) Do you mean filling out this command option? If you can share an example it would be helpful

Image

skpal-1 avatar Apr 08 '25 18:04 skpal-1

Probably you meant under debugging > Command arguments & working directory I will check if it is working. Thanks again.

Image

skpal-1 avatar Apr 08 '25 18:04 skpal-1

Yes, I meant the Debugging section, here's an example of settings to run one of the regression tests (assuming that you cloned the r-test submodule).

Image

deslaughter avatar Apr 08 '25 18:04 deslaughter

@deslaughter Thanks for the help. I could understand how to debug now. Will it be same for directly running in VS using release option? I see the following error.

Image

Regards,

skpal-1 avatar Apr 09 '25 08:04 skpal-1

While you can use the debugger to run OpenFAST even when compiled in the Release configuration, it will be slower than running it directly from the command line because the debugger will be trying to step through the program. As for your error, please check to see if the directory exists. If it doesn't exist, the the r-test submodule probably hasn't been initialized and you'll need to run git submodule update --init --recursive from a command prompt inside the directory you cloned into.

deslaughter avatar Apr 09 '25 13:04 deslaughter

@deslaughter thank you for the help. I see there is directory mismatch between the one specified in debugging > Command arguments & working directory =D:\OpenFAST_VS\code\openfast\reg_tests\r-test\r-test-main\glue-codes\openfast\5MW_Land_DLL_WTurb and the one shown in the error. I am curious why it could get the input files in the specified directory in debugging mode, however, not working for Release mode.

As you suggested, running git submodule update --init --recursive command help initializing r-test submodule, however, why it is necessary I could not understand. I would appreciate your help.

Regards,

skpal-1 avatar Apr 09 '25 15:04 skpal-1

@skpal-1 I agree that it's strange that it worked in Debug but not Release. Generally debugging won't work in Release mode anyway because the executable doesn't include the necessary symbols for the debugger to step through the code. The reason the git submodule update --init --recursive is needed is that a the regular git clone doesn't initialize submodules. This is desirable because the r-test submodule is rather large, so cloning it can take a long time. If you'd like to clone and initialize submodules at the same time, you can use git clone --recursive <URL>.

deslaughter avatar Apr 28 '25 15:04 deslaughter