Startup_Tech & Travel
Sunday, January 26, 2014
Wednesday, August 29, 2012
Ruby on Rails and TDD/BDD Books
After several-month web development in Ruby on Rails, I feel it may be a good time for me to conclude a lit bit about those Ruby on Rails books & materials I've read (far away from complete and welcome recommendations). No matter how many books we read, reading is just a start and approach of learning. More important is getting our hands dirty with code and development!!!
Ruby on Rails Tutorial-Learn Web Development with Rails
Best Ruby on Rails book for introduction! It provides great big pictures, good development practice (TDD/BDD) as well as necessary details for us to understand why besides how. (I still refer to this book time to time, after reading for 3 times)
Agile Web Development with Rails (4th edition)
After reading through "Ruby on Rails Tutorial" listed above, I got to this book which is also our cloud computing textbook. It's a good complement to the tutorials and opens a door to larger area of Rails. The only thing I'm not used to is they use Test::Unit in this book instead of RSpec+Capybara+Cucumber.
The RSpec Book: Behaviour-Driven Development with RSpec, Cucumber, and Friends
I'm a big fan of this book!!! Strongly recommend it to anyone who wanna be a developer in TDD/BDD. I can still remember the excitement when I read this book. It brought me to a brand new development world, totally different from the one I was in. Some parts look more like a reference book, so I decided to leave the remaining reading for the time I need it (familiar with my idea? Just borrowed it from some corners of this book and Extreme Programming. I first read this design principle in Design Patterns In Ruby, which book I'll also talk about in other post). I've been conforming to the practice in all Rails & Ruby developments since reading this book, benefiting a lot.
Rails 3 Way (2nd Edition)
A great reference book I always resort to besides online manual. It's also helpful to read through the book chapter by chapter (I've studied a lot by reading just a few chapters. Of course, there are still hundreds of pages left for my future reading...)
Ruby books (I'll publish another post about Ruby books, so here only give two references):
1. The Ruby Programming Language
2. Programming Ruby 1.9 (3rd edition): The Pragmatic Programmers' Guide (also called the Pickaxe Book)
I don't need to say anything about these two excellent books. I always keep them on my desk for reference or just for review reading. Only regret I started my Ruby study using the 1st one. My life should have been much happier if I went along with the Pickaxe Book...
Online materials:
Ruby on Rails Documentation
The first place I resort to when getting confusion in reading and coding. But sometimes the content lack details, so I'll turn to Rails 3 Way or Ruby on Rails - APIdock where we also turn to when stuck with Ruby and RSpec.
Ruby on Rails Guides
After I studies "Ruby on Rails Tutorial" and "Agile Web Development with Rails", this is the place I read to expand my Rails knowledge. It's not bad to read it section by section, when you feel confident with developing web app using Rails. When you read "RoR Guides", you probably won't feel so excited as reading the first two or three books of Rails. It's more like a review... (You may not think so if "RoR Guides" is the first material you read after finishing "Ruby on Rails Tutorial")
Ruby on Rails Tutorial-Learn Web Development with Rails
Best Ruby on Rails book for introduction! It provides great big pictures, good development practice (TDD/BDD) as well as necessary details for us to understand why besides how. (I still refer to this book time to time, after reading for 3 times)
Agile Web Development with Rails (4th edition)
After reading through "Ruby on Rails Tutorial" listed above, I got to this book which is also our cloud computing textbook. It's a good complement to the tutorials and opens a door to larger area of Rails. The only thing I'm not used to is they use Test::Unit in this book instead of RSpec+Capybara+Cucumber.
The RSpec Book: Behaviour-Driven Development with RSpec, Cucumber, and Friends
I'm a big fan of this book!!! Strongly recommend it to anyone who wanna be a developer in TDD/BDD. I can still remember the excitement when I read this book. It brought me to a brand new development world, totally different from the one I was in. Some parts look more like a reference book, so I decided to leave the remaining reading for the time I need it (familiar with my idea? Just borrowed it from some corners of this book and Extreme Programming. I first read this design principle in Design Patterns In Ruby, which book I'll also talk about in other post). I've been conforming to the practice in all Rails & Ruby developments since reading this book, benefiting a lot.
Rails 3 Way (2nd Edition)
A great reference book I always resort to besides online manual. It's also helpful to read through the book chapter by chapter (I've studied a lot by reading just a few chapters. Of course, there are still hundreds of pages left for my future reading...)
Ruby books (I'll publish another post about Ruby books, so here only give two references):
1. The Ruby Programming Language
2. Programming Ruby 1.9 (3rd edition): The Pragmatic Programmers' Guide (also called the Pickaxe Book)
I don't need to say anything about these two excellent books. I always keep them on my desk for reference or just for review reading. Only regret I started my Ruby study using the 1st one. My life should have been much happier if I went along with the Pickaxe Book...
Online materials:
Ruby on Rails Documentation
The first place I resort to when getting confusion in reading and coding. But sometimes the content lack details, so I'll turn to Rails 3 Way or Ruby on Rails - APIdock where we also turn to when stuck with Ruby and RSpec.
Ruby on Rails Guides
After I studies "Ruby on Rails Tutorial" and "Agile Web Development with Rails", this is the place I read to expand my Rails knowledge. It's not bad to read it section by section, when you feel confident with developing web app using Rails. When you read "RoR Guides", you probably won't feel so excited as reading the first two or three books of Rails. It's more like a review... (You may not think so if "RoR Guides" is the first material you read after finishing "Ruby on Rails Tutorial")
Friday, August 24, 2012
A quick review of singleton class(eigenclass) and class methods
First think about an object(o1)'s singleton methods.
For a method used just by this object(o1), you can't define a method in its class, since this will make this method available to all instances of the object's class. (An Class object in Ruby actually only have instance methods like:
class C1
def met1
# ...
end
end
Class method is more like an abstraction concept)
So we add an anonymous object (anon) between the object and its class, since this anon object only exists as a new class of the object and subclass of the object's original class, all its instance methods can be only called by the object, so this anon object is the singleton class(eigenclass) of the object o1, and its instance methods are singleton methods for the object o1.
Second,
If the object o1 represents a class (for example, o1's class is class Class), it can have its own methods, but these are instance methods that will be used by all
its instances, not by herself.
Based on the above explanations, we'll have a singleton class for this o1 if we considering this class object as an object (a lit confusing, but don't forget everything in Ruby is an object). The instance methods in this singleton class can only be called by the class object o1 and they're actually the class methods we saw in:
class C1
def self.met2
#...
end
end
To help understand, I borrow the pics from the classical the Pickaxe
Book: Programming Ruby 1.9. The big arrow indicates the addition of single method to the class object Dave (equivalent to class object o1 above)
Thursday, March 29, 2012
Install & start using Trilinos Libraries and Tools
After one whole day hacking in the total mess, finally got everything about Trilinos setup in my ubuntu linux. This blog is about how to install trilinos and its package from scratch, hoping others won't be staying up as late as me when taking this work...
1. The reason I reluctantly install Trilinos is all about using its OO framework in building our own large-scale computational software. Though it's so painful to kick off, I was told everything will get better after that. God bless so...
The introduction, download page, examples, almost everything of Trilinos can be found:
Trilinos Website
The install processes can also be reached from:
Trilinos Installation
2. Follow the processes in Trilinos Installation, first and second steps are trivial. If you also running ubuntu, just
> sudo apt-get install cmake
to update cmake to newest version.
After download the Clapack, try to follow section 5 in lawn81.pdf in clapack-3.2.1-CMAKE/INSTALL (clapack-3.2.1-CMAKE is the dir I extracted Clapack to). Don't care about section 6, it only makes ur life tough...
The only changes i did to make.inc are
uncomment #TIMER = EXT_ETIME.
change BLASLIB= ../../blas$(PLAT).a to BLASLIB = -lgoto -lpthread
change CC=gcc to CC= gcc -DNO_BLAS_WRAP
The last changes following the README.install, which is quite helpful if u have time reading it!
Then, just >make under clapack-3.2.1-CMAKE/.
Now we have blas_LINUX.a, lapack_LINUX.a, tmglib_LINUX.a in root dir and libf2c.a under F2CLIBS/. They will be used in cmake, make, and install of Trilinos.
At this time, > sudo apt-get install libblas-dev, liblapack-dev under command line, which should be necessary according to my experience. (I tried tens times to solve a link problem, finally get done by installing ubuntu's libblas and including it in do-configure file)
The most tricky part in installation is adapting do-configure file, here is my version (I just tried, tried and tried again, uncountable times... and got it work. I'm not even sure why the order should be like this...)
do-configure:
********************************************************************************
#!/bin/sh
EXTRA_ARGS=$@
rm -f CMakeCache.txt
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/home/rex/Trilinos \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \
-D CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ \
-D CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc \
-D CMAKE_Fortran_COMPILER:FILEPATH=/usr/bin/gfortran \
-D HAVE_GCC_ABI_DEMANGLE:BOOL=ON \
-D Trilinos_WARNINGS_AS_ERRORS_FLAGS:STRING="" \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=FALSE \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Teuchos:BOOL=ON \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D Trilinos_ENABLE_ALL_FORWARD_DEP_PACAKGES:BOOL=ON \
-D Trilinos_ENABLE_BLAS:BOOL=ON \
-D Trilinos_ENABLE_LAPACK:BOOL=ON \
-D Trilinos_ENABLE_Komplex:BOOL=ON \
-D BLAS_LIBRARY_DIRS:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE" \
-D BLAS_LIBRARY_NAMES:STRING="blas_LINUX.a;libf2c.a;libblas.so" \
-D TPL_BLAS_LIBRARIES:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a;/home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a;/usr/lib/libblas.so" \
-D BLAS_INCLUDE_DIRS:PATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE" \
-D LAPACK_LIBRARY_DIRS:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE" \
-D LAPACK_LIBRARY_NAMES:STRING="lapack_LINUX.a;tmglib_LINUX.a" \
-D TPL_LAPACK_LIBRARIES:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a;/home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a" \
-D LAPACK_INCLUDE_DIRS:PATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE" \
$EXTRA_ARGS \
../trilinos-10.10.1-Source
********************************************************************************
OK, now just type > make install and wait, wait, wait, maybe enjoy several cups of coffee... Now we finish first four steps. As mentioned in step 5 in Trilinos Installation, we'll find two dir's INCLUDE and LIB under /home/rex/Trilinos (which is the value of CMAKE_INSTALL_PREFIX:PATH in do-configure. set it as u wish before make install).
Now, we're done with the installation. To start using it, we must follow step 5 in Trilinos Installation to keep hacking tens mins or longer in Makefiles... Below is mine (enabled EPETRA, EPETRAEXT, TEUCHO, BELOS packages. If u wanna change it or add more, browse the two files: Export_Makefile_example.txt and Export_Makefile.txt. U'll know how to change it very quickly if following the format in my Makefile below:)
Makefile:
********************************************************************************
# CMAKE File for "MyApp" application building against an installed Trilinos
#This file is an adaptation of the CMakeLists.txt file that was converted from
#the buildAgainstTrilinos example. This Makefile was designed to be used in a
#flat directory structure. If you would like to run this example you will need
#put this file and src_file.cpp, src_file.hpp, main_file.cpp from
#buildAgainstTrilinos into a new directory. You will then need to set the
#environment variable MYAPP_TRILINOS_DIR to point to your base installation of
#Trilinos. Note that this example assumes that the installation of Trilinos that
#you point to has Epetra enabled.
# Get Trilinos as one entity
MYAPP_TRILINOS_DIR=/home/rex/Trilinos
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Belos
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Epetra
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.EpetraExt
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Teuchos
# Make sure to use same compilers and flags as Trilinos
CXX=/usr/bin/g++
CC=/usr/bin/gcc
FORT=/usr/bin/gfortran
CXX_FLAGS= -g -O0
C_FLAGS= -g -O0
FORT_FLAGS= -g
Trilinos_SHARED_LIB_RPATH_COMMAND=
Trilinos_BUILD_SHARED_LIBS=OFF
Trilinos_LINKER=/usr/bin/ld
Trilinos_AR=/usr/bin/ar
Trilinos_VERSION=10.10.1
Trilinos_TPL_INCLUDE_DIRS= -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/usr/include
Trilinos_TPL_LIBRARY_DIRS= -L/home/rex/Downloads/clapack-3.2.1-CMAKE/
Trilinos_TPL_LIBRARIES= /home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a /usr/lib/libblas.so /usr/lib/libpthread.so
Trilinos_PACKAGE_LIST= Belos EpetraExt Epetra Teuchos
Trilinos_TPL_LIST= LAPACK BLAS Pthread
Trilinos_INCLUDE_DIRS= -I/home/rex/Trilinos/include
Trilinos_LIBRARY_DIRS= -L/home/rex/Trilinos/lib
Trilinos_LIBRARIES= -lbelostpetra -lbelosepetra -lbelos -ltpetraext -ltpetrainout -ltpetra -lepetra -lkokkoslinalg -lkokkosnodeapi -lkokkos -ltpi -lteuchos -lepetraext -ltriutils -lzoltan -lsimpi
#Trilinos_LIBRARIES= -lbelostpetra -lbelosepetra -lbelos -ltpetraext -ltpetrainout -ltpetra -lepetra -lkokkoslinalg -lkokkosnodeapi -lkokkos -ltpi -lteuchos -lepetraext -ltriutils -lzoltan -lsimpi
#Trilions_TPL_INCLUDE_DIRS= -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/usr/include
#Trilinos_TPL_LIBRARY_DIRS=
#Trilinos_TPL_LIBRARIES= /home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a /usr/lib/libpthread.so
INCLUDE_DIRS=$(Trilinos_INCLUDE_DIRS) $(Trilinos_TPL_INCLUDE_DIRS)
LIBRARY_DIRS=$(Trilinos_LIBRARY_DIRS) $(Trilinos_TPL_LIBRARY_DIRS)
LIBRARIES=$(Trilinos_LIBRARIES) $(Trilinos_TPL_LIBRARIES)
LINK_FLAGS=$(Trilinos_EXTRA_LD_FLAGS)
#just assuming that epetra is turned on.
DEFINES=-DMYAPP_EPETRA
DEFINES=-DMYAPP_EPETRAEXT
DEFINES=-DMYAPP_TEUCHO
DEFINES=-DMYAPP_BELOS
default: print_info MyApp.out
# Echo trilinos build info just for fun
print_info:
@echo "\nFound Trilinos! Here are the details: "
@echo " Trilinos_VERSION = $(Trilinos_VERSION)"
@echo " Trilinos_PACKAGE_LIST = $(Trilinos_PACKAGE_LIST)"
@echo " Trilinos_LIBRARIES = $(Trilinos_LIBRARIES)"
@echo " Trilinos_INCLUDE_DIRS = $(Trilinos_INCLUDE_DIRS)"
@echo " Trilinos_LIBRARY_DIRS = $(Trilinos_LIBRARY_DIRS)"
@echo " Trilinos_TPL_LIST = $(Trilinos_TPL_LIST)"
@echo " Trilinos_TPL_INCLUDE_DIRS = $(Trilinos_TPL_INCLUDE_DIRS)"
@echo " Trilinos_TPL_LIBRARIES = $(Trilinos_TPL_LIBRARIES)"
@echo " Trilinos_TPL_LIBRARY_DIRS = $(Trilinos_TPL_LIBRARY_DIRS)"
@echo " Trilinos_BUILD_SHARED_LIBS = $(Trilinos_BUILD_SHARED_LIBS)"
@echo "End of Trilinos details\n"
# run the given test
#test: MyApp.exe input.xml
# ./MyApp.exe
# build the
#: libmyappLib.a
# libMyappLib.a
MyApp.out:
$(CXX) $(CXX_FLAGS) main.cpp -o MyApp.out $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)
#libmyappLib.a: src_file.o
# $(Trilinos_AR) cr libmyappLib.a src_file.o
#src_file.o:
# $(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) src_file.cpp
.PHONY: clean
clean:
rm -f *.o *.a *.exe
********************************************************************************
Now ctrl-C your cpp codes into main.cpp if just a small exmaple and > make , we'll get the executable MyApp.out and ./MyApp.out. Bingo! With small changes in Makefile above, we're ready to start using Trilinos and its powerful libs and OO frameworks!
1. The reason I reluctantly install Trilinos is all about using its OO framework in building our own large-scale computational software. Though it's so painful to kick off, I was told everything will get better after that. God bless so...
The introduction, download page, examples, almost everything of Trilinos can be found:
Trilinos Website
The install processes can also be reached from:
Trilinos Installation
2. Follow the processes in Trilinos Installation, first and second steps are trivial. If you also running ubuntu, just
> sudo apt-get install cmake
to update cmake to newest version.
After download the Clapack, try to follow section 5 in lawn81.pdf in clapack-3.2.1-CMAKE/INSTALL (clapack-3.2.1-CMAKE is the dir I extracted Clapack to). Don't care about section 6, it only makes ur life tough...
The only changes i did to make.inc are
uncomment #TIMER = EXT_ETIME.
change BLASLIB= ../../blas$(PLAT).a to BLASLIB = -lgoto -lpthread
change CC=gcc to CC= gcc -DNO_BLAS_WRAP
The last changes following the README.install, which is quite helpful if u have time reading it!
Then, just >make under clapack-3.2.1-CMAKE/.
Now we have blas_LINUX.a, lapack_LINUX.a, tmglib_LINUX.a in root dir and libf2c.a under F2CLIBS/. They will be used in cmake, make, and install of Trilinos.
At this time, > sudo apt-get install libblas-dev, liblapack-dev under command line, which should be necessary according to my experience. (I tried tens times to solve a link problem, finally get done by installing ubuntu's libblas and including it in do-configure file)
The most tricky part in installation is adapting do-configure file, here is my version (I just tried, tried and tried again, uncountable times... and got it work. I'm not even sure why the order should be like this...)
do-configure:
********************************************************************************
#!/bin/sh
EXTRA_ARGS=$@
rm -f CMakeCache.txt
cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/home/rex/Trilinos \
-D CMAKE_BUILD_TYPE:STRING=DEBUG \
-D CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ \
-D CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc \
-D CMAKE_Fortran_COMPILER:FILEPATH=/usr/bin/gfortran \
-D HAVE_GCC_ABI_DEMANGLE:BOOL=ON \
-D Trilinos_WARNINGS_AS_ERRORS_FLAGS:STRING="" \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=FALSE \
-D Trilinos_ENABLE_Belos:BOOL=ON \
-D Trilinos_ENABLE_Teuchos:BOOL=ON \
-D Trilinos_ENABLE_Epetra:BOOL=ON \
-D Trilinos_ENABLE_TESTS:BOOL=ON \
-D Trilinos_ENABLE_ALL_FORWARD_DEP_PACAKGES:BOOL=ON \
-D Trilinos_ENABLE_BLAS:BOOL=ON \
-D Trilinos_ENABLE_LAPACK:BOOL=ON \
-D Trilinos_ENABLE_Komplex:BOOL=ON \
-D BLAS_LIBRARY_DIRS:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE" \
-D BLAS_LIBRARY_NAMES:STRING="blas_LINUX.a;libf2c.a;libblas.so" \
-D TPL_BLAS_LIBRARIES:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a;/home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a;/usr/lib/libblas.so" \
-D BLAS_INCLUDE_DIRS:PATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE" \
-D LAPACK_LIBRARY_DIRS:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE" \
-D LAPACK_LIBRARY_NAMES:STRING="lapack_LINUX.a;tmglib_LINUX.a" \
-D TPL_LAPACK_LIBRARIES:FILEPATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a;/home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a" \
-D LAPACK_INCLUDE_DIRS:PATH="/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE" \
$EXTRA_ARGS \
../trilinos-10.10.1-Source
********************************************************************************
OK, now just type > make install and wait, wait, wait, maybe enjoy several cups of coffee... Now we finish first four steps. As mentioned in step 5 in Trilinos Installation, we'll find two dir's INCLUDE and LIB under /home/rex/Trilinos (which is the value of CMAKE_INSTALL_PREFIX:PATH in do-configure. set it as u wish before make install).
Now, we're done with the installation. To start using it, we must follow step 5 in Trilinos Installation to keep hacking tens mins or longer in Makefiles... Below is mine (enabled EPETRA, EPETRAEXT, TEUCHO, BELOS packages. If u wanna change it or add more, browse the two files: Export_Makefile_example.txt and Export_Makefile.txt. U'll know how to change it very quickly if following the format in my Makefile below:)
Makefile:
********************************************************************************
# CMAKE File for "MyApp" application building against an installed Trilinos
#This file is an adaptation of the CMakeLists.txt file that was converted from
#the buildAgainstTrilinos example. This Makefile was designed to be used in a
#flat directory structure. If you would like to run this example you will need
#put this file and src_file.cpp, src_file.hpp, main_file.cpp from
#buildAgainstTrilinos into a new directory. You will then need to set the
#environment variable MYAPP_TRILINOS_DIR to point to your base installation of
#Trilinos. Note that this example assumes that the installation of Trilinos that
#you point to has Epetra enabled.
# Get Trilinos as one entity
MYAPP_TRILINOS_DIR=/home/rex/Trilinos
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Belos
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Epetra
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.EpetraExt
include $(MYAPP_TRILINOS_DIR)/include/Makefile.export.Teuchos
# Make sure to use same compilers and flags as Trilinos
CXX=/usr/bin/g++
CC=/usr/bin/gcc
FORT=/usr/bin/gfortran
CXX_FLAGS= -g -O0
C_FLAGS= -g -O0
FORT_FLAGS= -g
Trilinos_SHARED_LIB_RPATH_COMMAND=
Trilinos_BUILD_SHARED_LIBS=OFF
Trilinos_LINKER=/usr/bin/ld
Trilinos_AR=/usr/bin/ar
Trilinos_VERSION=10.10.1
Trilinos_TPL_INCLUDE_DIRS= -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/usr/include
Trilinos_TPL_LIBRARY_DIRS= -L/home/rex/Downloads/clapack-3.2.1-CMAKE/
Trilinos_TPL_LIBRARIES= /home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a /usr/lib/libblas.so /usr/lib/libpthread.so
Trilinos_PACKAGE_LIST= Belos EpetraExt Epetra Teuchos
Trilinos_TPL_LIST= LAPACK BLAS Pthread
Trilinos_INCLUDE_DIRS= -I/home/rex/Trilinos/include
Trilinos_LIBRARY_DIRS= -L/home/rex/Trilinos/lib
Trilinos_LIBRARIES= -lbelostpetra -lbelosepetra -lbelos -ltpetraext -ltpetrainout -ltpetra -lepetra -lkokkoslinalg -lkokkosnodeapi -lkokkos -ltpi -lteuchos -lepetraext -ltriutils -lzoltan -lsimpi
#Trilinos_LIBRARIES= -lbelostpetra -lbelosepetra -lbelos -ltpetraext -ltpetrainout -ltpetra -lepetra -lkokkoslinalg -lkokkosnodeapi -lkokkos -ltpi -lteuchos -lepetraext -ltriutils -lzoltan -lsimpi
#Trilions_TPL_INCLUDE_DIRS= -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/home/rex/Downloads/clapack-3.2.1-CMAKE/INCLUDE -I/usr/include
#Trilinos_TPL_LIBRARY_DIRS=
#Trilinos_TPL_LIBRARIES= /home/rex/Downloads/clapack-3.2.1-CMAKE/lapack_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/tmglib_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/blas_LINUX.a /home/rex/Downloads/clapack-3.2.1-CMAKE/libf2c.a /usr/lib/libpthread.so
INCLUDE_DIRS=$(Trilinos_INCLUDE_DIRS) $(Trilinos_TPL_INCLUDE_DIRS)
LIBRARY_DIRS=$(Trilinos_LIBRARY_DIRS) $(Trilinos_TPL_LIBRARY_DIRS)
LIBRARIES=$(Trilinos_LIBRARIES) $(Trilinos_TPL_LIBRARIES)
LINK_FLAGS=$(Trilinos_EXTRA_LD_FLAGS)
#just assuming that epetra is turned on.
DEFINES=-DMYAPP_EPETRA
DEFINES=-DMYAPP_EPETRAEXT
DEFINES=-DMYAPP_TEUCHO
DEFINES=-DMYAPP_BELOS
default: print_info MyApp.out
# Echo trilinos build info just for fun
print_info:
@echo "\nFound Trilinos! Here are the details: "
@echo " Trilinos_VERSION = $(Trilinos_VERSION)"
@echo " Trilinos_PACKAGE_LIST = $(Trilinos_PACKAGE_LIST)"
@echo " Trilinos_LIBRARIES = $(Trilinos_LIBRARIES)"
@echo " Trilinos_INCLUDE_DIRS = $(Trilinos_INCLUDE_DIRS)"
@echo " Trilinos_LIBRARY_DIRS = $(Trilinos_LIBRARY_DIRS)"
@echo " Trilinos_TPL_LIST = $(Trilinos_TPL_LIST)"
@echo " Trilinos_TPL_INCLUDE_DIRS = $(Trilinos_TPL_INCLUDE_DIRS)"
@echo " Trilinos_TPL_LIBRARIES = $(Trilinos_TPL_LIBRARIES)"
@echo " Trilinos_TPL_LIBRARY_DIRS = $(Trilinos_TPL_LIBRARY_DIRS)"
@echo " Trilinos_BUILD_SHARED_LIBS = $(Trilinos_BUILD_SHARED_LIBS)"
@echo "End of Trilinos details\n"
# run the given test
#test: MyApp.exe input.xml
# ./MyApp.exe
# build the
#: libmyappLib.a
# libMyappLib.a
MyApp.out:
$(CXX) $(CXX_FLAGS) main.cpp -o MyApp.out $(LINK_FLAGS) $(INCLUDE_DIRS) $(DEFINES) $(LIBRARY_DIRS) $(LIBRARIES)
#libmyappLib.a: src_file.o
# $(Trilinos_AR) cr libmyappLib.a src_file.o
#src_file.o:
# $(CXX) -c $(CXX_FLAGS) $(INCLUDE_DIRS) $(DEFINES) src_file.cpp
.PHONY: clean
clean:
rm -f *.o *.a *.exe
********************************************************************************
Now ctrl-C your cpp codes into main.cpp if just a small exmaple and > make , we'll get the executable MyApp.out and ./MyApp.out. Bingo! With small changes in Makefile above, we're ready to start using Trilinos and its powerful libs and OO frameworks!
Wednesday, February 8, 2012
Accent
My American friend just told me he thought my accent got thicker when we came back from a long-time winter vacation, and guessed it's because i didn't get much chance talking in English. En~~~ I never thought about that before, maybe i need watch more TV shows to improve or at least keep my English not getting worse, lol~~
(the man in the pic above is Xi Huang (Joe Wong), a rising comedian star in US, originally from China and got his phd in US. He often takes advantage of his Chinese accent and tells stories about foreigners' life in US to entertain the audience.)
(the man in the pic above is Xi Huang (Joe Wong), a rising comedian star in US, originally from China and got his phd in US. He often takes advantage of his Chinese accent and tells stories about foreigners' life in US to entertain the audience.)
Subscribe to:
Posts (Atom)