19 April 2012

118. Solution to nwchem: SHMMAX too small

Update: also see this post: http://verahill.blogspot.com.au/2012/10/shmmax-revisited-and-shmall-shmmni.html

When running nwchem using mpirun I've occasionally encountered this error.

Error:
******************* ARMCI INFO ************************
The application attempted to allocate a shared memory segment of 44498944 bytes in size. This might be in addition to segments that were allocated succesfully previously. The current system configuration does not allow enough shared memory to be allocated to the application.

This is most often caused by:
1) system parameter SHMMAX (largest shared memory segment) being too small or
2) insufficient swap space.
Please ask your system administrator to verify if SHMMAX matches the amount of memory needed by your application and the system has sufficient amount of swap space. Most UNIX systems can be easily reconfigured to allow larger shared memory segments,
see http://www.emsl.pnl.gov/docs/global/support.html
In some cases, the problem might be caused by insufficient swap space.
*******************************************************
0:allocate: failed to create shared region : -1
(rank:0 hostname:boron pid:17222):ARMCI DASSERT fail. shmem.c:armci_allocate():1082 cond:0

Diagnosis:
Check the currently defined shmmax:
cat /proc/sys/kernel/shmmax
33554432
Well, 33554432<44498944, so it seems that it's caused by reason 1 above.

Solution:

Edit /etc/sysctl.conf
Add a line saying
kernel.shmmax=44498944
Save and reboot. The exact value is up to you -- I've set my shmmax to 128*1024*1024=134217728, while our production cluster has 6269961216.

Update: to change it on the fly do
sudo sysctl -w kernel.shmmax=6269961216

18 April 2012

117. Sorting out framebuffer in linux (debian)

If you have /dev/fb0 you're fine -- you have a working frame buffer, and that was the case on my laptop and my optiplex 990. However, my homebuilt boxes didn't have any framebuffer devices.

This is how to set up framebuffer:

sudo apt-get install hwinfo
sudo hwinfo --framebuffer

02: None 00.0: 11001 VESA Framebuffer                        
  [Created at bios.464]
  Unique ID: rdCR.fRULN9k9OD4
  Hardware Class: framebuffer
  Model: "Intel(r)Cantiga Graphics Controller"
  Vendor: "Intel Corporation"
  Device: "Intel(r)Cantiga Graphics Controller"
  SubVendor: "Intel(r)Cantiga Graphics Chip Accelerated VGA BIOS"
  SubDevice:
  Revision: "Hardware Version 0.0"
  Memory Size: 127 MB + 960 kB
  Memory Range: 0xd0000000-0xd7feffff (rw)
  Mode 0x0360: 848x480 (+896), 8 bits
  Mode 0x0361: 848x480 (+1728), 16 bits
  Mode 0x0362: 848x480 (+3392), 24 bits
  Mode 0x0305: 1024x768 (+1024), 8 bits
  Mode 0x0317: 1024x768 (+2048), 16 bits
  Mode 0x0318: 1024x768 (+4096), 24 bits  Mode 0x0312: 640x480 (+2560), 24 bits
  Mode 0x0314: 800x600 (+1600), 16 bits
  Mode 0x0315: 800x600 (+3200), 24 bits
  Mode 0x0301: 640x480 (+640), 8 bits
  Mode 0x0303: 800x600 (+832), 8 bits
  Mode 0x0311: 640x480 (+1280), 16 bits
  Config Status: cfg=new, avail=yes, need=no, active=unknown
Pick a mode e.g. 0x0318

Edit your /etc/default/grub

Add vga=0x0318 to the GRUB...DEFAULT line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet nouveau.modeset=0 vga=0x0318"

If there's a nomodeset command, delete it.

Do
sudo update-grub

and reboot. You're done.

There should now be a /dev/fb0 and your resolution when working in a TTY* should be different.

*the terminal you get to by doing alt+f1, alt+f2 etc.

What to do with framebuffers?
Apart from making your ttys look a lot nicer and work at higher resolution, they'll also allow you to use w3m-img for ncurses based browsing with images (w3m+w3m-img; sometimes it's useful), and to take screenshots of the terminal in terminal mode. But mostly, it just makes your terminal experience better through being at higher resolution.


More modes:
02: None 00.0: 11001 VESA Framebuffer                        
  [Created at bios.464]
  Unique ID: rdCR.efxRnBcYXs5
  Hardware Class: framebuffer
  Model: "NVIDIA GF108 Board - 1071v0p1"
  Vendor: "NVIDIA Corporation"
  Device: "GF108 Board - 1071v0p1"
  SubVendor: "NVIDIA"
  SubDevice:
  Revision: "Chip Rev"
  Memory Size: 14 MB
  Memory Range: 0xd7000000-0xd7dfffff (rw)

  Mode 0x0300: 640x400 (+640), 8 bits
  Mode 0x0301: 640x480 (+640), 8 bits
  Mode 0x0303: 800x600 (+800), 8 bits
  Mode 0x0305: 1024x768 (+1024), 8 bits
  Mode 0x0307: 1280x1024 (+1280), 8 bits
  Mode 0x030e: 320x200 (+640), 16 bits
  Mode 0x030f: 320x200 (+1280), 24 bits
  Mode 0x0311: 640x480 (+1280), 16 bits
  Mode 0x0312: 640x480 (+2560), 24 bits
  Mode 0x0314: 800x600 (+1600), 16 bits
  Mode 0x0315: 800x600 (+3200), 24 bits
  Mode 0x0317: 1024x768 (+2048), 16 bits
  Mode 0x0318: 1024x768 (+4096), 24 bits
  Mode 0x031a: 1280x1024 (+2560), 16 bits
  Mode 0x031b: 1280x1024 (+5120), 24 bits
  Mode 0x0330: 320x200 (+320), 8 bits
  Mode 0x0331: 320x400 (+320), 8 bits
  Mode 0x0332: 320x400 (+640), 16 bits
  Mode 0x0333: 320x400 (+1280), 24 bits
  Mode 0x0334: 320x240 (+320), 8 bits
  Mode 0x0335: 320x240 (+640), 16 bits
  Mode 0x0336: 320x240 (+1280), 24 bits
  Mode 0x033d: 640x400 (+1280), 16 bits
  Mode 0x033e: 640x400 (+2560), 24 bits
  Mode 0x0345: 1600x1200 (+1600), 8 bits
  Mode 0x0346: 1600x1200 (+3200), 16 bits
  Mode 0x034a: 1600x1200 (+6400), 24 bits
  Mode 0x0360: 1280x800 (+1280), 8 bits
  Mode 0x0361: 1280x800 (+5120), 24 bits
  Config Status: cfg=new, avail=yes, need=no, active=unknown





Links to this post:
http://pinboard.in/u:greppy

11 April 2012

116. [Solved] Latex bug -- "tcfmgr: config file `tcfmgr.map' (usually in $TEXMFMAIN/texconfig) not found."


Symptom:
When using latexila or texmaker no dvi/ps/pdf is generated. No outright error is report though

When trying to generate the pdf in the terminal using latex e.g.

me@beryllium:~$ latex nature_draft.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
kpathsea: Running mktexfmt latex.fmt
tcfmgr: config file `tcfmgr.map' (usually in $TEXMFMAIN/texconfig) not found.
I can't find the format file `latex.fmt'!
 kpsewhich -expand-var='$TEXMFMAIN'
gives
/usr/share/texmf/

which is the correct file structure as defined by texmf.cnf

kpsewhich texmf.cnf
/usr/share/texmf/web2c/texmf.cnf

So what the heck is going on? I've written articles, reviews and book in latex and never had a problem until now. Also, it only happens on one computer.

Solution:
I ended up just fooling around. What solved it was doing
sudo texconfig rehash
mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN...
mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVE...
mktexlsr: Updating /var/lib/texmf/ls-R...
mktexlsr: Done.
That's all. Really.

Minor note:
you can run texonfig interactively as well. Just make sure to run it using sudo.



Links to this post:
http://tex.stackexchange.com/questions/64894/error-i-cant-find-the-format-file-pdflatex-fmt