Installing deal.II v6.2.1 (deal II) on Mac OSX v10.5.8

September 21st, 2009

Apparently installing deal.II (finite element library) on a Mac, seems like a fairly straightforward thing, in practice it took me a loot of time to do it because there was one very nasty thing that had to be done and it was not at all obvious. So I try here to give a walkthrough of all the steps I took to install deal.II on my mac. I installed it with MPI, so that I could use the multiprocessing capabilities.PRE-REQUISITESIn order to install deal.II you need to have installed some other packages:

  • LAPACK and BLAS
  • OpenMPI (v1.3.3)
  • Boost (v1.4.0)
  • PETSc (v2.3.3)

Let’s do it by parts, you should follow this order of installation:Directory structureI decided to install all libraries, except the compiler and LAPACK and BLAS on my home directory. I put all my source files and downloaded archived on a folder:~/Programs/srcAll the installed libraries I put them on a folder inside:~/Programs/installSo, most probably you do not have this directory structure hence open a terminal window and do the following to create these directories:

1
mkdir ~/Programs
2
mkdir ~/Programs/src
3
mkdir ~/Programs/install

LAPACK and BLASIn order to compile anything you need a compiler, hence you need something like the gcc collection. You can use some other compilers but I haven’t tried them. The easiest way to get up and running with compilers on a mac it’s by installing Xcode and the Xcode gFortran plugin. With this you get the gcc collection and also gfortran.For free you also get an optimized version of LAPACK and BLAS with vecLib. Hence you don’t need to have any additional work in order to have LAPACK and BLAS installed.OpenMPII installed version 1.3.3. You can dowload it from here. You can either download it from the browser and put it in the ~/Programs/src folder or you can go to the terminal and do:

1
cd ~/Programs/src
2
wget http://www.open-mpi.org/software/ompi/v1.3/downloads/openmpi-1.3.3.tar.gz

After this just extract the contents of the archive:

3
tar xvf openmpi-1.3.3.tar.gz

Now go inside the newly created directory:

4
cd openmpi-1.3.3

Run configure with the prefix to the directory where we want to install openMPI, in this case inside ~/Programs/install/openmpi:

5
./configure --prefix=~/Programs/install/openmpi

This should configure all the compilation variables with no problem so, after all the output just start compiling:

6
make all

Then install:

7
make install

If everything went fine you should have openMPI installed properly. Now it is only necessary to update your PATH and some other environment variables. To do that you need to edit your .bash_profile file, hence to do it type:

8
emacs ~/.bash_profile

Once emacs is open with your .bash_profile file, just add the following lines to it:

# Set up environment variables for openmpiexport PATH=/Users/gorkiana/Programs/install/openmpi/bin:${PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/lib:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/lib/openmpi:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/include:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/include/openmpi/ompi/mpi/cxx/:${LD_LIBRARY_PATH}export DYLD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/lib:${DYLD_LIBRARY_PATH}export DYLD_LIBRARY_PATH=/Users/gorkiana/Programs/install/openmpi/lib/openmpi:${DYLD_LIBRARY_PATH}

Notice that /Users/gorkiana/Programs/install… is for my own computer, my username is gorkiana, so you should put your own username instead of gorkiana. Save it with control+x+s and exit with control+x+c.Now run your updated bash_profile:

9
. ~/.bash_profile

Now you should have a properly working openMPI. To check if in fact it is, move inside the examples directory:

10
cd examples

And make all the example programs:

11
 make all

Run some of the examples, for example:

12
 mpirun -n 2 hello_c

You should get something like this as output:

13
Hello, world, I am 0 of 2
14
Hello, world, I am 1 of 2

If you get this you have a well installed OpenMPI! Next step.BoostI installed version version 1.4.0. You can download it from here. You can either download it from the browser and put it inside your ~/Programs/src folder or you can go to the terminal and type:

1
wget http://downloads.sourceforge.net/project/boost/boost/1.40.0/boost_1_40_0.tar.gz?use_mirror=kent

After that you must extract the contents of the archive, for that do:

2
tar xvf boost_1_4_0.tar.gz

Move to the extracted directory:

3
cd boost_1_4_0

Run the configuration script:

4
./bootstrap.sh --prefix=~/Programs/install/boost_1_4_0

Edit the file ./user-config.jam:

5
emacs ./user-config.jam

Add the following line: using mpiSave and exit with control+x+s and control+x+c.Build Boost and install it:

6
./bjam install

Now you just need to add some directories to the environment variables by editing your .bash_profile file. Type:

6
emacs ~/.bash_profile

And add the following lines:

# Set up environment variable for boost_1_4_0export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/boost_1_4_0/lib:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/boost_1_4_0/boost/include:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=/Users/gorkiana/Programs/install/boost_1_4_0/boost:${LD_LIBRARY_PATH}export DYLD_LIBRARY_PATH=/Users/gorkiana/Programs/install/boost_1_4_0/lib:${DYLD_LIBRARY_PATH}

Save and exit with: control+x+s and control+x+c.You should now have a working installation of Boost! Next step…PETScI installed version version 2.3.3. You can download it from here. You can either download it from the browser and put it inside your ~/Programs/src folder or you can go to the terminal and type:

1
cd ~/Programs/src
2
wget http://ftp.mcs.anl.gov/pub/petsc/software_old/petsc-2.3.3.tar.gz

After that you must extract the contents of the archive, for that do:

2
tar xvf petsc-2.3.3.tar.gz

Move to the extracted directory:

3
cd petsc-2.3.3-p15

Now you need to set up some environment variables for PETSc:

4
export PETS_DIR=~/Programs/src/petsc-2.3.3-p15
5
export PETS_ARCH=macosx

Run the configuration program:

6
python ./config/configure.py --prefix=~/Programs/install/petsc-2.3.3 --with-blas-lapack-lib="-framework vecLib" --with-mpi-dir=~/Programs/install/openmpi/ --with-shared=1 --with-debugging=0

This says that one should use the vecLib LAPACK and BLAS libraries, the openmpi installation that we just did, generate shared libraries and don’t build debugging libraries, that is, build optimized libraries. Good for production code, faster.Now build it:

7
make all

VERY IMPORTANTYou should see a lot of output. When it finishes you should check if there was any error in the end stating that it was unable to make the shared libraries. You can also check if you have any .dylib files (shared libraries) in the directory ~/Programs/src/petsc-2.3.3-p15/lib/macosx. Just type:

8
ls ~/Programs/src/petsc-2.3.3-p15/lib/macosx | grep .dylib

If you get several files, than you are ok, if not, then you need to do the following. This is very important since if you do not have this files, you are stuck in this step and you are unable to build deal.II. This was what took me a lot of time to solve. Thank you Wendy Mason from the Underworld project for the helpful solution!If you do not have the dylib files you need to edit the file ~/Programs/src/petsc-2.3.3-p15/bmake/common/rules.shared.based, doing:

9
emacs ~/Programs/src/petsc-2.3.3-p15/bmake/common/rules.shared.based

Search for a line where there is something like shared_darwin8: shared_darwin7 and add the following line after that one:

10
shared_darwin9: shared_darwin7

Save the file and exit with control+x+s and control+x+c.Make the shared libraries with:

11
make PETSC_ARCH=macosx shared

Now this should work and you should have the shared libraries. Redo:

12
ls ~/Programs/src/petsc-2.3.3-p15/lib/macosx | grep .dylib

And confirm that in fact you have the .dylib files you need.Just install it:

13
make install

Now you just need to add some directories to the environment variables by editing your .bash_profile file. Type:

14
emacs ~/.bash_profile

And add the following lines:

# Set up environment variables for pets-2.3.3export PATH=~/Programs/install/petsc-2.3.3/bin:${PATH}export LD_LIBRARY_PATH=~/Programs/install/petsc-2.3.3/lib/macosx:${LD_LIBRARY_PATH}export LD_LIBRARY_PATH=~/Programs/install/petsc-2.3.3/include:${LD_LIBRARY_PATH}export PETSC_DIR=~/Programs/install/petsc-2.3.3export PETSC_ARCH=macosx

Save and exit with: control+x+s and control+x+c.Run you new bash_profile:

15
. ~/.bash_profile

You should now have a working installation of PETSc! Next step.deal.III installed version version 6.2.1. You can download it from here. You can either download it from the browser and put it inside your ~/Programs/src folder or you can go to the terminal and type:

1
cd ~/Programs/src
2
wget http://www.dealii.org/download/deal.nodoc-6.2.1.tar.gz

After that you must extract the contents of the archive, for that do:

3
tar xvf deal.nodoc-6.2.1.tar.gz

Move to the extracted directory:

4
cd deal.II

Run the configuration script:

5
./configure CC=mpicc CXX=mpicxx --with-boost-include=/Users/gorkiana/Programs/install/boost_1_4_0/include/boost --with-boost-lib=/Users/gorkiana/Programs/install/boost_1_4_0/lib LIBS="-framework vecLib"

Notice that one has to give the MPI compilers no the default ones. If you do not do this, then you will get an error stating that it cannot find some MPI functions. Also you need to give Boost directories and LAPACK and BLAS connected to vecLib, the Apple provided optimized version of LAPACK and BLAS.The configuration process should work fine, after this you just need to build:

6
make all

You should now have a working installation of deal.II.

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Installing Trilinos in Mac OSX 10.5.7

September 10th, 2009

To get Trilinos to work it is necessary to get it from here and compile it.In order for the compilation to be successful it is needed a c compiler, a c++ compiler and a fortran compiler. One set of these compilers is given by the gcc bundle. If you install Xcode from Apple you will get gcc and g++ but not gfortran. To get gfortran you can use the one given by macports. Having downloaded Trilinos, you must unpack it. Now, inside the root dir of the unpacked Trilinos tree you should create a directory for you build, even if you just plan on making one build, this is always good. I name it OSX_SINGLE, and move inside it, doing:

1
mkdir OSX_SINGLE
1
cd OSX_SINGLE

Now inside it you should run config, but running config with no special settings gives rise to problems. Hence you should use the following:

1
../configure --cache-file=config.cache --prefix=/usr/local/trilinos-8.0.8-serial CC=/usr/bin/gcc CXX=/usr/bin/g++ F77=/usr/local/bin/gfortran --with-libs="-framework vecLib" --with-ldflags="-Wl,-multiply_defined -Wl,suppress" --enable-amesos --enable-epetra --enable-anasazi --enable-aztecoo --enable-examples --enable-didasko --enable-teuchos --enable-triutils --enable-galeriD

Doing this it should result in a good configuration for make.After this Trilinos is now able to be compiled. To do that you should run:

1
make everything

And then if everything was compiled correctly you should install it, with sudo:

1
sudo make install

After this you should have a working Trilinos installation.

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Melhores coreografias em vídeos de música

October 27th, 2008

Estava a rever este vídeo dos Moloko, Forever More, e achei que a coreografia estava bastante engraçada. Lembrei-me de mais alguns vídeos com coreografias interessantes e decidi juntá-los aqui.

Mologo: Forever More

Björk: It’s oh so quiet!

Daft Punk: Around the world

Jamiroquai: Virtual Insanity

E claro, o grande clássico dos Temptations: My girl, não podia ser excluído.

Este é o melhor, mas não dá para se embedido: http://www.youtube.com/watch?v=ltRwmgYEUr8

Este também é bom, mas não tão bom.

Este não são coreografias propriamente ditas, mas são bastante curiosos:

Justice vs Simian: We are Friends (dica da Ana V. S.):

E MGMT: Time to pretend (dica da Ana V.S. e do Nuno F.):

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Como está a robótica?

October 27th, 2008

Hoje vi um artigo que comentava um dos projectos do Departamento de Defesa dos Estados Unidos da América sobre robôts. O objectivo é:

“Develop a software and sensor package to enable a team of robots to search for and detect human presence in an indoor environment.”

Nada de mais, o mais interessante está no meio do texto, quando dizem:

“This topic seeks to merge these research areas and develop a software/hardware suit that would enable a multi-robot team, together with a human operator, to search for and detect a non-cooperative human subject.”

Um bocado assustador e Orwelliano, não?

Fiquei curioso sobre o estado da arte da robótica, por isso fui procurar no youtube alguns vídeos. Devem estar bastante desfasados do estado da arte, mas dá para extrapolar.

Robôts que fazem kung fu com bastante fluidez, da sony, salvo erro.

Big dog, um quadrupede com um equilíbrio incrível.

Braço prostético, controlado por impulso nervosos.

Um braço robótico ligado directamente ao cérebro de um macaco.

O robot da Honda, também com um equilíbrio incrível.

Mais um humanoide.

del.icio.us Slashdot Digg Technorati Google StumbleUpon

O portátil Magalhães ou como se fazem escolhas enviesadas

October 25th, 2008

Recentemente entrei em discussão com um blogger que também é repórter do Expresso, chamado Paulo Querido, tudo circulou em torno deste de um post intitulado Magalhães o sucesso público. Podem ler o post e ver melhor o que é dito lá, mas resumindo, é defendido que é algo excepcional para o desenvolvimento do país, não só porque estimula as crianças, eliminando a info-exclusão, como também é um grande impulsionador do desenvolvimento tecnológico do país porque o computador é feito em Portugal.

Não vou entrar nos detalhes da discussão toda, vou-me centrar na parte do desenvolvimento tecnológico do país. O Magalhães é um computador portátil desenvolvido pela Intel, baseado no OLPC, mas com uma arquitectura completamente fechada. Em Portugal iremos apenas assemblar peças que já vêem pré-feitas de outro lado qualquer. Acresce a isto o facto de não ser possível aceder aos blueprints do computador. Resumindo, não há qualquer benefício para o país em termos de desenvolvimento tecnológico, tanto como uma fábrica da Volkswagen nos permitiu desenvolver um carro português.

O mais interessante é o facto de existirem alternativas completamente abertas de computadores portáteis com características técnicas semelhantes, como por exemplo o projecto da VIA, openbook. Se esta plataforma tivesse sido escolhida parao investimento do Estado seria talvez um bom pontapé de saída para algum desenvolvimento tecnológico em Portugal. Esta sim, poderia criar a “semente do hacker” (como diz o Paulo Querido). Aí sim, talvez pudéssemos ver universidades a desenvolverem, a partir do que já existe, nova tecnologia. Poderíamos deixar de ser macaquinhos de imitação.

Era bom…

del.icio.us Slashdot Digg Technorati Google StumbleUpon

A explosão dos comuns?

October 24th, 2008

Opensource:

“is a development method for software that harnesses the power of distributed peer review and transparency of process. The promise of open source is better quality, higher reliability, more flexibility, lower cost, and an end to predatory vendor lock-in.”

opensource initialive

http://www.opensource.org

Muito se tem defendido a propriedade privada, quer de bens físicos quer intelectuais. Tem sido sempre vista como um pilar imprescindível à sustentação da inovação, do desenvolvimento, do progresso. O grande argumento para a sustentação vem do facto de apenas a propriedade privada assegurar o incentivo necessário a que as pessoas criem algo novo, seja material, seja intelectual.

É interessante ver como, cada vez, surgem projectos, bastante sólidos, que contradizem estas aparentes verdades irrefutáveis.

Não vou entrar no software livre, já tão batido. Encontrei recentemente este artigo sobre uma empresa italiana chamada Arduino que concebeu, desenvolveu e agora contrói e vende uma placa controladora, sim daquelas que, por exemplo, os estudantes usam para fazer projectos de sistemas de aquisição de dados. É um microprocessador, com uma linguagem de programação própria, desenvolvida pela empresa, e uma série de possibilidades de entradas e saídas. Nada de muito inovador, tirando o facto de ser bastante bem recebida pelos utilizadores e, pasmem-se, ser completamente aberta. Sim, todos os esquemáticos estão disponíveis para download e os criadores incentivam vivamente a cópia e a produção em larga escala.

 Curioso, não é?

1- O facto de a empresa estar funcional, emprega pessoas e continua a vender produtos.

2- O facto de os criadores não terem como objectivo único o lucro, mas sim a satisfação das pessoas que utilizam o produto deles e o desenvolvimento do produto.

Um bocado contrário aos valores que nos entram pelas orelhas dentro diariamente.

No artigo é dito relativamente a um dos criadores da placa:

“describes himself as a left-leaning academic who’s less interested in making money than in inspiring creativity and having his invention used widely. If other people make copies of it, all the better; it will gain more renown.”

 Felizmente parece que há outros valores pelos quais as pessoas se regem

 -artur palha

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Documentário: Money as debt

October 24th, 2008

O meu amigo Guillaume encontrou este vídeo e, numa troca de emails sobre o nosso sistema económico recomendou-me este vídeo. Vi-o hoje, já pela madrugada dentro. Está muito interessante. É espantoso como a questão é tão simples mas não está presente em quase ninguém. A mim esclareceu-me algumas ideias.

Uma coisa interessante que o filme não foca, ou só muito superficialmente, é o papel do lucro na questão do dinheiro e a sua ligação com o crédito. Sim, porque não concordo que os únicos maus da fita são os banqueiros.

Era interessante fazer um estudo de fluxos de dinheiro e ver que numa empresa os produtos postos no mercado somam, por exemplo 1000€, dos quais 600€ vão para pagar o valor incorporado nos produtos através do trabalho e as matérias primas, os outros 400€ são o chamado lucro. A questão é que os produtos colocados à venda pela empresa e que devem ser consumidos, essencialmente pelos trabalhadores (são a maioria da população) não podem ser totalmente consumidos porque o dinheiro que receberam (600€) é menos que o valor total dos produtos postos em circulação (1000€). Gera-se aqui um problema de sobreprodução.

A questão que coloco é esta: até que ponto a questão do crédito não é uma questão de “que maus são os banqueiros” mas sim que peça chave são estes banqueiros para o esquema irracional deste sistema económico?

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Björk fala sobre como funciona a TV

October 22nd, 2008

Encontrei este vídeo da Björk, já um pouco antigo, a explicar como funcioana a TV. É engraçado que a Björk está a encarnar a sua personagem “islandesa que vive na Islândia, um país onde só há gelo e por isso é muito ingénua”. Só depois de ter visto algumas entrevistas dela é que percebi que não é mesmo assim de facto. Esta aparente ingenuidade quase de menina é uma personagem dela.

Voltando ao vídeo. Encontrei-o aqui:  hackaday

Não é propriamente uma explicação do funcionamento dos raios catódicos, é sim uma visão com uma roupagem ingénua, mas muito lúcida de poder alienante da televisão e do cientifismo.

No entanto é estranho e parece que ela acha que esta visão de que a televisão são mentiras de poetas. Eu acho que está a ser ingénua e faz também uma crítica ao cientifismo.

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Koop, Melweg e Amesterdão

March 9th, 2008

Dia 21 de Fevereiro fui a Amesterdão pela primeira vez. Fui ver um concerto de Koop.

Tive apenas uma visão de relance da cidade, mas foi daqueles relances que deixam a semente da curiosidade cá dentro. Ficam aqui só uns vídeos do concerto.

del.icio.us Slashdot Digg Technorati Google StumbleUpon

Photos update

March 9th, 2008

Just added the following photo galleries:

  1. Scheveningen by Daniele
  2. Daniele’s vision of Delft
  3. Koop concert Amsterdam by Daniele
  4. Daniele’s vision of Rotterdam
  5. Daniele playing with lights and lasers at TUDelft
  6. Dinner at Valerio’s house, with the crazy japanese guy

del.icio.us Slashdot Digg Technorati Google StumbleUpon