Installing VS for UDFs
Hello, I am hoping to create a UDF for ANSYS Fluent 2020 R2, and have installed VS 2019 for reasons that aren't fully clear to me, as most tutorials I have seen involve using a simple text editor to create basic UDFs. However, when I try to load the function, I get the following error:
No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\Users\itb7\Documents\ansys projects\udftest2_files\dp0\FFF\Fluent\libudf\win64\2ddp_host\SConstruct", line 5, in <module>
It seems that the VS 2019 needs to be set up to work with ANSYS somehow, but I can't find any information on how the setup process actually works. I would really appreciate any advice!
Comments
@itb7 Please install Visual Studio 2019 with the options noted in this screenshot.
Thank you,
Matt
@mmadore Thank you for the help. My installer does not have all the options shown on the right column, will it work with these settings?
Those look like they should be sufficient.
@mmadore
I have added those features and restarted my computer, but the same error is happening. Is there a step somewhere that I actually need to link Fluent to the VS files or is it supposed to just "know" that they are there?
@itb7 Can you please open a command prompt and run the command "set" without quotes and send me the full output?
@mmadore
Microsoft Windows [Version 10.0.18363.1256]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\itb7>set
ADSK_CLM_WPAD_PROXY_CHECK=FALSE
ALLUSERSPROFILE=C:\ProgramData
ANSYS202_DIR=C:\Program Files\ANSYS Inc\ANSYS Student\v202\ANSYS
ANSYS_SYSDIR=winx64
APPDATA=C:\Users\itb7\AppData\Roaming
AWP_LOCALE202=en-us
AWP_ROOT202=C:\Program Files\ANSYS Inc\ANSYS Student\v202
CADOE_LIBDIR202=C:\Program Files\ANSYS Inc\ANSYS Student\v202\CommonFiles\Language\en-us
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=ASUS
ComSpec=C:\WINDOWS\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
HOMEDRIVE=C:
HOMEPATH=\Users\itb7
LOCALAPPDATA=C:\Users\iantb\AppData\Local
LOGONSERVER=\\ASUS
LSTC_LICENSE=ANSYS
NUMBER_OF_PROCESSORS=8
OMP_NUM_THREADS=8
OneDrive=C:\Users\itb7\OneDrive - Binghamton University
OneDriveCommercial=C:\Users\itb7\OneDrive - Binghamton University
OneDriveConsumer=C:\Users\itb7\OneDrive
OS=Windows_NT
Path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Calibre2\;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X64\;C:\Program Files (x86)\Pulse Secure\VC142.CRT\X86\;C:\Program Files\dotnet\;C:\Users\iantb\AppData\Local\Microsoft\WindowsApps;C:\Users\iantb\.dotnet\tools
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 23 Model 24 Stepping 1, AuthenticAMD
PROCESSOR_LEVEL=23
PROCESSOR_REVISION=1801
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
P_SCHEMA=C:\Program Files\ANSYS Inc\ANSYS Student\v202\AISOL\CADIntegration\Parasolid\PSchema
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\itb7\AppData\Local\Temp
TMP=C:\Users\itb7\AppData\Local\Temp
USERDOMAIN=ASUS
USERDOMAIN_ROAMINGPROFILE=ASUS
USERNAME=itb7
USERPROFILE=C:\Users\itb7
windir=C:\WINDOWS
@itb7
First, make sure there are no spaces in the path. I see you have "ansys projects", please close that space or replace with _
Can you let me know the exact process you are trying to follow to compile your UDF? The steps should be to launch FLUENT 2020R2 -> User Defined -> Compiled -> Add -> browse for your .c file which should be saved in "~\udftest2_files\dp0\FFF\Fluent\" -> Build -> Load
Please share the entire contents of the FLUENT console output.
@mmadore I've made a new folder without spaces and set up a new project to test this out. The process I've been using to compile the UDF is exactly as you describe, and I've been checking off the box that says "use built-in compiler" in the popup menu. I've attached the Fluent console output in the notepad file.
@mmadore just wanted to follow up on this problem-- I attempted compiling a blank .c file as a UDF and it didn't return the same errors, but as soon as anything else gets put in I still receive the message that the C compiler is not set correctly. Do you know of any other way I could fix this issue?
@itb7 Can you try without the "use built-in compiler" box checked?
Thanks,
Matt
@mmadore The udf still fails to load, although the error is slightly different. I'm putting the Fluent log below:
Copied C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent/C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\forumdoc.c to libudf\src
Creating user_nt.udf file for 3ddp_host ...
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v202\fluent"\fluent20.2.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")'nmake' is not recognized as an internal or external command,
operable program or batch file.
Creating user_nt.udf file for 3ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v202\fluent"\fluent20.2.0\src\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")'nmake' is not recognized as an internal or external command,
operable program or batch file.
Done.
ASUS: Opening library "C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libudf"...
Error at Node 1: The UDF library you are trying to load (libudf) is not compiled for paralle
Error at Node 3: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).
The
Error at Node 4: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).
The system cannot find the file spe
Error at Node 5: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).
The system cannot find the cified.
C:\Users\itb7\Documents\ANSYSProjefile specified.
C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libudf\win64\3ddp_node\libudf.dll
l use on the current platform (win64).
The system cannot find the file specified.
C:\Users\ system cannot ficts\udftest3_files\dp0\FFF\Fluent\libudf\win64\3ddp_node\libudf.dll
itb7\Documents\ANSYSProjects\udftest3_fil
Error at Node 2: The UDF lind the file specified.
C:\Users\itb7\DocumentEs\ANSYSProjects\udftest3_files\dp0ebr\FFF\Fluent\libudf\win64\3ddp_norarde\libudf.dll
RPC RCX_SC_SET_ERR_MSG failed: RPC: Can't encode arguments
ror at Nsoy you are trying tod load (leibudf) is not compiled for parallel use on the
Error at host: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).
The system cannot find the current platform file specified.
C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libudf\win64\3ddp_host\libudf.dll
(win64).
The system cannot find the file specified.
C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libud0:f\win64\3ddp_node\libudf.dll
\dThe pUD0\FFFF\F lluenibrary yout\l are tryinibudf\wing64\3ddp_node \libudf.dll
to load (libudf) is not compiled for parallel use on the current platform (win64).
The system cannot find the file specified.
C:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libudf\win64\3ddp_node\libudf.dll
===============Message from the Cortex Process================================
Compute processes interrupted. Processing can be resumed.
==============================================================================
Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nThe system cannot find the file specified.
\n\nC:\Users\itb7\Documents\ANSYSProjects\udftest3_files\dp0\FFF\Fluent\libudf\win64\3ddp_host\libudf.dll
@itb7 I am checking with a colleague on any additional suggestions.
@itb7 Can you please try these steps?
1. Open up the Visual Studio 2019 x64 Native Tools Command Prompt window and change to your working directory where your case and data reside.
2. Create an ANSYS Fluent v1xx.x shortcut on the desktop
3. Drag the ANSYS Fluent shortcut into the x64 Native tools Command Prompt window.
4. Press Enter
5. ANSYS Fluent launcher opens.
6. Go to Environment tab and uncheck "Set up Compilation Environment for UDF"
7. On the "General Options" tab, make sure your “Working Directory” is set to the location where your case, data and UDF is located in.
8. Launch Fluent and try to compile a UDF, with "use built-in compiler" unchecked.
@mmadore built a new simulation in a new folder to make sure any previous settings wouldn't interfere. I otherwise followed the instructions above, and everything described was exactly where specified. It looks like the error generated is slightly different, and rather than saying "C directory is not set up properly", it says "not compiled for parallel use on the current platform." I will try and set it up on one core of the computer to see if it will at least work under those circumstances, although I don't think I can run any practical simulations in this manner. I'm attaching the Fluent output below.
@mmadore output from running Fluent without parallel computing is below.
@itb7 Please open the Visual Studio 2019 x64 Native Tools Command Prompt and enter "cl" without the quotes and send a screenshot of the entire window and output.
@mmadore
@itb7 Can you try running Fluent from the command prompt again and compiling, but instead use the "x64_x86 Cross Tools Command Prompt for VS 2019" rather than the "x64 Native Tools Command Prompt"?
@mmadore it seems to have returned the same error.
Hi @mmadore , I have the same error here
I'm using 2020 R2, & enable "Built-In Compilers"
I've tried set the system variable, launch Fluent outside workbench, Install Microsoft visual studio community 2019 (will try 2017 soon)
So the problem Statement is, when in Compiled UDFs
"Built" and will become:
"'C:\PROGRA~1\ANSYS' is not recognized as an internal or external command, operable program or batch file."
LOAD and will become:
"Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nThe system cannot find the file specified."
Do ANSYS team knows, with Build-In Compiler, is the problem still lies within Visual Studio? Because if it doesn't we can certainly skip the MS Visual Studio and look other way.
Or the problem is more to the Build-in Compilers itself. Is there anyway to check on Build-In Compilers? DO we have any patch and installer to re-install on ANSYS Patch?