Search the Community
Showing results for tags 'User Defined Functions'.
Found 2 results
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 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. 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.
If you have a compiler on your system, make sure the /bin/ directory of the AcuSolve installation is included in the PATH environment variable. Then from the compiler command prompt - and in the directory where the UDF is located - issue acuMakeDll. For example, on a WIN64 machine with Visual Studio 2005 installed, place the following in the C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64\vcvarsamd64.bat file. These lines can be copied from the \bin\Acusim.bat file located in the AcuSolve installation. set ACUSIM_HOME=C:\Acusim\ set ACUSIM_VERSION=V1.8b set ACUSIM_MACHINE=WIN64 set ACUSIM_ROOT=%ACUSIM_HOME%\%ACUSIM_MACHINE%\%ACUSIM_VERSION% set ACUSIM_SYSTEM_CNF=%ACUSIM_ROOT%\script\Acusim.cnf set ACUSIM_CNF_FILES=.\Acusim.cnf:~\Acusim.cnf:%ACUSIM_SYSTEM_CNF% set PATH=%ACUSIM_ROOT%\base\lib\site-packages;%PATH% set PATH=%ACUSIM_ROOT%\base\DLLs;%PATH% set PATH=%ACUSIM_ROOT%\base\bin;%PATH% set PATH=%ACUSIM_ROOT%\bin;%PATH% There is no compiler included with the AcuSolve distribution, so you will need to obtain your own compiler. It needs to be a 32-bit compiler for 32-bit installations, and a 64-bit compiler for 64-bit installations.