Configuración de placa de video NVIDIA para correr CUDA en Ubuntu 13.04

Hace unos meses me compré un nuevo PC de escritorio con el objetivo de comenzar a aprender acerca de la programación CUDA . El nuevo PC tenía una tarjeta de video Intel integrada y una NVIDIA GeForce GT620 . La idea fue utilizar la tarjeta de video integrada para el servidor X , dejando a la GeForce dedicada a ejecutar simulaciones .Cuando traté de instalar el controlador de la tarjeta NV , las cosas empezaron a ir mal , porque el conductor NV reemplazar las librerías OpenGL Mesa con los suyos. Debido a que el xserver realmente funciona en la tarjeta de vídeo Intel , que es incompatible con las librerías OpenGL de propiedad, OpenGL dejó de funcionar y, en consecuencia , también la unidad se rompió .Después de un par de noches tratando de hacer que funcione , me encontré con que el truco para hacer que todos de trabajar es , después de la instalación del driver de nvidia , vuelva a instalar las bibliotecas originales del mesa glx . Este es el procedimiento correcto :* Desinstalar los componentes NV en el sistema



   
# sudo nvidia-uninstall

   
# sudo apt-get purge nvidia*

  
* Descargue los últimos drivers oficiales desde el sitio web NV: http://www.nvidia.com/object/linux-display-amd64-319.60-driver.html* Instale los paquetes necesarios para el instalador

    
# Sudo apt-get install linux -headers -`uname -r`
* Los siguientes pasos requieren el xserver detuvo. Por lo tanto , ir a un terminal ( Ctrl + Alt + F1) y detener el xserver . Por ejemplo ,

     #
sudo stop lightdm


* Instale el controlador# cd ruta/donde/están/los/drivers # sudo chmod +x NVIDIA-Linux-x86_64-319.60.run # sudo
./NVIDIA-Linux-x86_64-319.60.run 
* En este punto , el conductor está bien, pero nuestra xserver mostraría problemas con las librerías de Open GL . Sin embargo, la GPU está listo :# sudo nvidia-smidebe mostrar el estado de la GPU.* Ahora , para evitar el problema de las bibliotecas Open GL , hay que ( re)instalar tanto el servidor X y de las bibliotecas Mesa:# sudo apt-get install -reinstall xserver-xorg-core  xserver-xorg-video-(tu driver de video) xserver-xorg-libgl1-mesa-glx* Reinicie el sistemaAhora, usted puede instalar el Kit de herramientas CUDA , evitando volver a instalar los drivers NV ...

Configuring CUDA in Ubuntu 13.04

Some months ago I bought a new Desktop PC with the aim to start learning about CUDA programming. The new PC had an integrated INTEL video card, and a NVIDIA GeForce GT620. The idea was use the integrated video card for the xserver, leaving the GeForce dedicated to run simulations.

When I tried to install the driver for  the NV card, things started to go wrong, because the NV driver replace the mesa OpenGL  libraries with theirs. Because the xserver actually works on the Intel video card, which is incompatible with the proprietary openGL libraries, openGL stopped working and as a result, also Unity got broken.


After a couple of evenings trying to make it work, I found that the trick to make all be working  is, after the installation of the nvidia driver, reinstall the original  mesa glx libraries. Here is the right procedure:


* Uninstall all NV components on the system

   # sudo nvidia-uninstall
   # sudo apt-get purge nvidia*

   
* Download the last official drivers  from the NV web site: http://www.nvidia.com/object/linux-display-amd64-319.60-driver.html


* Install the required packages for the installer
 
   # sudo apt-get install linux-headers-`uname -r`


* The next steps requires the xserver stopped. So,   Go to a terminal (Ctrl + Alt + F1) and stop the xserver. For instance,

     # sudo stop lightdm


* Install driver

# cd path/where/you/save/drivers
# sudo chmod +x  NVIDIA-Linux-x86_64-319.60.run
# sudo ./NVIDIA-Linux-x86_64-319.60.run


* At this point, the driver is OK, but our xserver would show problems with the Open GL libraries.  However, the GPU is ready:

# sudo nvidia-smi

should show the status of the GPU.

* Now, to avoid the problem with the Open GL libraries, we (re) install  both our xserver and the mesa libraries:

# sudo apt-get  install --reinstall xserver-xorg-core  xserver-xorg-  libgl1-mesa-glx


* Reboot the system

Now, you can install the CUDA Toolkit, avoiding to reinstall the NV drivers...






Una implementación de simetría de paridad en las librerías ALPS

Me gustaría compartir un parche para el código ALPS que le permite trabajar en sistemas que presentan simetría de paridad. Algunos ejemplos típicos de este tipo de simetría son Hamiltonianos de espín en campos transversos (modelo XY, Dzyaloshinskii Moriya), bosónicos y fermiónicos con acoplamiento de pairing, el modelo de Jaynes-Cummings, etc, en los que  Sz y/o N son números cuánticos no conservados.Los observables conservados asociados a este tipo de simetría son de la forma 


P = \ prod_ {j} \ exp (i \ pi Q_j) 

donde Q_j es un  número cuántico de paridad local (por ejemplo, en un modelo n_j bosonic / fermiónico, o Sz_i S + en un modelo de espín). Al final de este post encontrarán un par de referencias con más detalles sobre esta simetría,  en algunos modelos en los que he trabajado. 

 La utilidad de implementar este tipo de simetría es doble: por un lado, permite reducir el tamaño del espacio de Hilbert, lo que permite llevar a cabo simulaciones que de otro modo serían imposibles. Por otra parte, se mejora la convergencia hacia el verdadero estado  fundamental de estos sistemas, ya que la diferencia de energía entre el estado fundamental de los sectores  correspondientes a paridades diferentes son a menudo muy pequeños. 


El código actual sólo funciona ahora para los códigos de  diagonalización  completo y sparse, y estoy trabajando en una ampliación para el código dmrg.Aquí está un ejemplo para el archivo de parámetros:

 MODEL_LIBRARY = "models.xml"
 MODEL = "spin-paridad";
 LATTICE = "chain lattice";
 CONSERVED_QUANTUMNUMBERS = "Parity(ParityCharge) ";
 JXY = -1.;
 Jz = 0.;
 L = 20;
 local_S = 0.5;
 {H = .46;} 

En el archivo model.xml por defecto se incluye un ejemplo para la definición de una base local, una base global y un hamiltoniano de espín.


References
Two soluble models of an antiferromagnetic chain,
E. Lieb, T. Schultz and D. Mattis,
Ann. Phys. (NY) 16 , 407 (1961).

Entanglement of finite cyclic chains at factorizing fields,
R. Rossignoli, N. Canosa, J.M.Matera,
Physical Review A 77 (2008) 052322.
Separability and entanglement in finite dimer-type chains in general transverse fields,
N. Canosa, R. Rossignoli, J.M. Matera,
Physical Review B 81 (2010) 054415.
Factorization and entanglement in general XYZ spin arrays in non-uniform transverse fields,
R. Rossignoli, N. Canosa, J.M. Matera,
Physical Review A 80 (2009) 062325.

Parity implementation in ALPS

I would like share a patch to the ALPS code which allows it to handle problems with parity-like constraints. Some typical examples of this kind of symmetry are transversal spin Hamiltonias (XY mode, Dzyaloshinskii Moriya), bosonic and fermionic pairing couplings,Jaynes-Cummings like models, etc, for which Sz and N quantum numbers are not conserved.

This kind of constraints has the form

P=\prod_{j} \exp(i \pi Q_j )

being Q_j a local parity quantum number (for instance, n_j in a bosonic/fermionic model, or Sz_i+S in a spin model). At the end of this post you will find a couple of references with more details about this symmetry in some models in which I have worked.

The utility of take implement this kind of symmetry is twofold: on the one side, it allows to reduce the size of the Hilbert space, allowing to carry out simulations that would otherwise be imposible. On the other hand, it improves the convergence to the true ground state of these systems, because the gap between the ground state  of both different parity sectors are often very small.

The current code just working now for the full and sparse diagonalization code, and I am working on an implementation to the dmrg code.


Here is an example for the parameter file:

MODEL_LIBRARY="models.xml"
MODEL="spin-parity";
LATTICE="chain lattice";
CONSERVED_QUANTUMNUMBERS="
Parity(ParityCharge)";
Jxy=-1.;
Jz=0.;
L=20;
local_S=.5;
{h=.46;}

An example for the definition of the local basis, the global basis and the hamiltonian was included in the default model.xml file.


References
Two soluble models of an antiferromagnetic chain,
E. Lieb, T. Schultz and D. Mattis,
Ann. Phys. (NY) 16 , 407 (1961).

Entanglement of finite cyclic chains at factorizing fields,
R. Rossignoli, N. Canosa, J.M.Matera,
Physical Review A 77 (2008) 052322.
Separability and entanglement in finite dimer-type chains in general transverse fields,
N. Canosa, R. Rossignoli, J.M. Matera,
Physical Review B 81 (2010) 054415.
Factorization and entanglement in general XYZ spin arrays in non-uniform transverse fields,
R. Rossignoli, N. Canosa, J.M. Matera,
Physical Review A 80 (2009) 062325.

AucTeX


Some years ago, I found a very useful tool for anyone who write articles in LaTeX:
AucTeX.


It is an emacs complement that allow us to see, inside the text editor, the equations that we write, as well as figures and tables in a "WYSIWIG" way, without the necesity of compiling the text each time.



Up to the Ubuntu version 10.10,  we could install just it writing in a command line

$ sudo apt-get install auctex

Unfortunately,  since the version 11.04, the package stopped working well, seemly, because of a problem with the library versions.

To fix it, simply download the source code of the package from .... , compile and install it.


To make it easier, here you can download a .deb package generated from these sources.   After installing the official version of auctex, simply install the package with the corrections:

$ sudo apt-get install auctex


I hope you find it useful.