Thursday, July 18, 2013

A guide to Install and use Trilinos for beginners part II

In my previous blog I explained how I installed the Amesos package with mpi support.
Here I would like to show how to compile a simple program.

Lets say that in the working directory the main file is test_amesos.cpp. To compile this we have to create an empty Makefile file, then copy the content of this file to the empty file.
In the first line replace the environmental variable $(MYAPP_TRILINOS_DIR) with the path where the trilinos-11.0.3-Source for example was extracted.

Next you need to replace the MyApp.exe name and src_file with the correct ones. For example if you want to build an executable test_amesos then you have to change the following lines as:

default: print_info test_amesos
test: test_amesos input.xml


$(CXX) $(CXX_FLAGS) test_amesos o -o test_amesos $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)

$(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) test_amesos.cpp

Note that you can comment the lines 
libmyappLib.a: src_file.o
 $(Trilinos_AR) cr libmyappLib.a src_file.o

Once the Makefile is properly set you can compile the program by typing:
$make clean 
(Optionally to remove any existing object files) and finally compile with
$make test_amesos

No comments: