Sunday, May 08, 2016

problems with X crashes on newer Ubuntu

My Ubuntu install has had problems with random freezes after an upgrade to 12.04. Finally, when starting to do some serious simulation work, I decided to do something about it.

The first thought was that firefox was causing the crashes, since the freezes would start most often while starting firefox. But then, found the crashes happening when starting other apps as well. Suspected X, or the display driver, and wanted to use vesa instead. Many of the methods listed, like blacklisting nouveau, did not work with 16.04  - even after reboots, nouveau driver was being listed as used by lsmod.

Final solution was to create a /etc/X11/xorg.conf - which does not exist by default. As mentioned at many places, the procedure to do this was:
Switch to a console. Ctrl+Shift+F2, for example.
Kill the display manager with sudo service lightdm stop (or whichever dm is running)
Generate a new xorg.conf with sudo X -configure
Edit the xorg.conf.new created in current directory, replacing all instances of nouveau with vesa
Move it with a rename to /etc/X11 with sudo mv xorg.conf.new /etc/X11/xorg.conf
Restart X with sudo service lightdm start

Unfortunately with Vesa, the screen refreshes are very laggy, even with Lubuntu. But no crashes. 

Saturday, May 07, 2016

Thursday, May 05, 2016

python using a single core for numpy

A point which came up when using pynlo:

A longish reply for the question why python uses only one core for numpy -
http://stackoverflow.com/questions/15639779/why-does-multiprocessing-use-only-a-single-core-after-i-import-numpy

In short, core affinity can be reset using
os.system("taskset -p 0xff %d" % os.getpid())
after the module imports. But this would be useful only for multi-threaded programs, of course. 

Wednesday, May 04, 2016

mounting a samba share with read-write permissions

Mounting a shared network drive on our internal server running Ubuntu - to make it read and write enabled, PB reports the command to be:
sudo mount –t cifs //ip-address/Share_name /local/mount/path –o username=correct_uname,uid=local_uid,gid=local_uid

Then, the local_uid user has read + write permissions.

Edit: 11 July 2016

This post about listing hostname with ip address is useful.

Also, PB adds one more tip - for mounting shares with spaces, use single quotes
sudo mount -t cifs '//192.168.1.1/SHARE WITH SPACES' tempmount  -o username=guest,password='',nounix,sec=ntlmssp

Tuesday, May 03, 2016

installing and using pynlo

Looking around for supercontinuum generation literature, came across PyNLO's documentation. Tried to install and use it. Was a bit of a struggle at first, but finally it all came together.

Issues:

  1. Anaconda3 version 4.0 installation on Windows XP failed - reported that it failed to change path variable etc, but more importantly, the exes were not running - "this is not a valid Windows executable".
  2. On Ubuntu 14.04, tried a direct pip install. Some dependency issues. Thought upgrading to 16.04 would help - ran out of hard disk space - 13 GB. Formatted and installed Lubuntu instead. With many hiccups on the way - like while doing a manual partitioning, we must not touch the swap space - because that is where the installer stores the installation files!
  3. With Anaconda3 and pynlo, errors like Missing parenthesis in call to print - so had to install Anaconda2 instead.
  4. Trying installation with pip install pynlo - installation of the required pyfftw failed with the error  fftw3.h: No such file or directory - it needed libfftw2-dev as mentioned in the comments at this post
  5. After pynlo installed also, running the example script gave errors IOError: [Errno 2] No such file or directory: .../pynlo/media/fibers/nist_fibers.txt and on copy-pasting general_fibers.txt to nist_fibers.txt, an assertion error - pynlo/interactions/FourWaveMixing/SSFM.py, line 662, in conditional_fftshift assert chksum == np.sum(abs(x)) AssertionError
Solutions:
  1. Currently pynlo needs Python 2.7 to run, won't run on Python3. So, install Anaconda2 and not Anaconda3. 
  2. On Windows, this page says that Windows XP is supported only for Anaconda versions 2.2 and below, so downloaded 2.2 instead of the latest.  
  3. Installing libfftw2-dev on Linux with apt-get install libfftw2-dev solved the pyfftw install issues. Similarly, on Windows, the way to install it is given at https://pypi.python.org/pypi/pyFFTW#downloads - ie. download the fftw dlls and put them in the same folder as the pyfftw wheel folder before install. The pyfftw whl file was installed as pip install wheelfile.whl without any issues. 
  4. Using the latest git code solved all the pynlo issues, using
    pip install git+https://github.com/pyNLO/PyNLO.git like this post
  5. Git for windows was installed from https://git-scm.com/download/win
  6. On Windows XP, everything was 32 bit, and the example took 55 seconds to run. On 64-bit Lubuntu, it ran in almost the same time. Lubuntu's desktop CPU meter indicates that it was using only one core of my dual-core Athlon, ie. 50% cpu.   

freeing up space on ubuntu

This post has lots of useful information in the answers. I removed libre-office and old kernels to get 1.5 GB. For the removing the old kernels, I followed
1. uname -r to know current kernel
2. sudo apt-get remove kernelname1 kernelname2 etc after doing
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt-get install localpurge
and
rm -Rf /tmp
etc.

The listing of all packages with sizes with
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less
is also a nice trick to use.