Compiling User Defined Functions
AcuSolve comes with utilities to compile User Defined Functions (UDF) on both Windows and Linux. The following instructions provide instructions on how to use these utilities to compile a UDF.
Linux:
UDFs are compiled on Linux using the acuMakeLib script. This script uses the gcc compiler by default. If gcc is installed, acuMakeLib will use the gcc command to compile and link the udf. The following example will compile a UDF named usrInflow.c using an optimization level of 3:
acuMakeLib -src usrInflow.c -opt O3
Windows:
Microsoft Visual Studio Express 2012 provides a free compiler that can be used on Windows 7 and newer macines for both 32 bit and 64 bit applications. The compiler can be downloaded from the following link:
http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop
Be sure to select 'Visual Studio 2012 Express for Windows Desktop' when downloading.
Once the package is downloaded and installed, you will need to configure your environment such that the compiler shows up in your path. This can be accomplished through manipulation of the PATH environment variable, but is more easily accomplished using the following procedure:
1.) Launch the command prompt for the compiler (assuming a 64 bit Windows machine). The proper start menu link is as follows: Start-->All Programs-->Microsoft Visual Studio 2012-->Visual Studio Tools-->VS2012 x64 Cross Tools Command Prompt
<?xml version="1.0" encoding="UTF-8"?>
2.) Execute the 'acusim.bat' file from within the Visual Studio command prompt. This will set up the AcuSolve environment. An easy way to accomplish this is by copying the 'Target' of the AcuSovle Cmd Prompt desktop icon and pasting it into the VS command prompt.
<?xml version="1.0" encoding="UTF-8"?>
3.) The UDF can then be compiled from the Visual Studio command prompt using the acuMakeDll script. Keep in mind that the message passing type you intend to use for the simulation must be compiled into the DLL on Windows. The following example will compile a UDF named usrInflow.c that is suitable for running using the Intel MPI message passing interface:
acuMakeDll -src usrInflow.c -mpi impi
More infomration on acuMakeDll and acuMakeLib are available in the AcuSolve Programs Reference Manual.
Answers
-
Hello:
I have encountered some problems in learning acusolve acu-4002, and I have been unable to run gravity.c file. My compiler software has been installed (VS2013), and the environment configuration has been completed according to the relevant information (Figure 1). However, the following problem was encountered in operation (Figure 2). The gravity. obj file cannot be found, nor can the. Dll file be generated.
I also tried to run gravity. C program separately in VS2013, but I also found many errors. (Fig. 3)
1. error LNK2019: Unparsable external symbol _udfCheckNumUsrVals, which is referenced in function _usrGravity
2. error LNK1120: Three unresolved external commands
3. IntelliSense: Undefined identifier 'Integer'
4. IntelliSense: Undefined identifier 'String'
5. IntelliSense: Undefined identifier 'Void'
6. IntelliSense: Undefined identifier 'Real'
I hope you can help me. Thank you very much.
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
0 -
Already in other thread...
0