Archive for the ‘Software’ Category

Even though the parted command shows the partition as ext3, you can format it as ext4.

(parted) mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to
continue?
Yes/No? Yes                                                               
(parted) unit TB
(parted) mkpart primary 0.00TB 10.00TB
(parted) p                                                                
Model: LSI MR9261-8i (scsi)
Disk /dev/sda: 9.99TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 1      0.00TB  9.99TB  9.99TB  ext3         primary

(parted) quit                                                             
Information: You may need to update /etc/fstab.

[root@mh ~]# mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
305025024 inodes, 2440183808 blocks
122009190 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
74469 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544, 1934917632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done       

[root@mh ~]# blkid
/dev/sda1: UUID="1485be35-8319-4a49-b0bd-9ee465303b41" TYPE="ext4" PARTLABEL="primary" PARTUUID="a7f0e3ef-3e72-4bc9-849a-90dde882f07f" 
/dev/sdb1: UUID="6ca14ed0-e5e0-422a-9e82-ea72fc84516b" TYPE="ext4" 
/dev/sdb2: UUID="ceb6e531-4a0a-49b9-9e59-d8f1ae4593c6" TYPE="swap" 
/dev/sdb3: UUID="ab27cea4-abc8-49d8-894f-2c39408b196f" TYPE="ext4" 
[root@mh ~]# blkid|grep sda
/dev/sda1: UUID="1485be35-8319-4a49-b0bd-9ee465303b41" TYPE="ext4" PARTLABEL="primary" PARTUUID="a7f0e3ef-3e72-4bc9-849a-90dde882f07f" 
[root@mh ~]# blkid|grep sda >> /etc/fstab
[root@mh ~]# vi /etc/fstab
[root@mh ~]# mount -a

First need to install the fftw library. Download it here.

# ./configure --prefix=/code/fftw-3.3.4 --with-pic
# make
# make install

The –with-pic bit was added because the ROOT compilation complained about it.

For ROOT, –with-fftw3-incdir is directory with fftw3.h and –with-fftw3-libdir is directory with fftw library.

# ./configure --prefix=/code/root_v5.34.20 --enable-qt --with-fftw3-incdir=/code/fftw-3.3.4/include --with-fftw3-libdir=/code/fftw-3.3.4/lib
...
Enabled support for asimage, astiff, builtin_afterimage, builtin_ftgl, builtin_glew, builtin_lzma, cintex, explicitlink, fftw3, genvector, krb5, ldap, memstat, mysql, opengl, pgsql, python, reflex, shadowpw, shared, sqlite, ssl, tmva, vdt, x11, xft, xml.

# make
# make install

Normally, I’d do a make -j2 above. But, for some reason, it would just hang at a particular point in the compilation. So I took off the -j2 and things seemed to work.

$ root-config –features
asimage astiff builtin_afterimage builtin_ftgl builtin_glew builtin_lzma cintex explicitlink fftw3 genvector krb5 ldap memstat mysql opengl pgsql python reflex shadowpw shared sqlite ssl tmva vdt x11 xft xml thread

Our VME system is somewhat old, running Scientific Linux 4.7. Unfortunately, I was never able to get a newer version of the operating system working with these computers.

I needed to compile a program on this system. And the first attempt gave me tons of errors:

[root@wahcrate koto]# gcc adclossless.c -o adclossless -lvme
In file included from /usr/include/stdio.h:28,
                 from adclossless.c:1:
/usr/include/features.h:1: error: stray '\31' in program
/usr/include/features.h:1: error: stray '\139' in program
/usr/include/features.h:1: error: stray '\8' in program
/usr/include/features.h:1: error: stray '\2' in program
/usr/include/features.h:1: error: stray '\3' in program

Since I can’t really update this program, my hack to get this working was to copy any header files that were causing errors from a different computer. I copied the following files from a system running Red Hat Enterprise Linux, version 5.

/usr/include/features.h
/usr/include/gconv.h
/usr/include/alloca.h
/usr/include/errno.h
/usr/include/fcntl.h
/usr/include/getopt.h

In case this caused any problems, I renamed the old files first to .OLD. Lastly, the compilation complained about the file /usr/include/endian.h not being present. So I copied that file too.

After that the compilation worked.

[root@wahcrate koto]# gcc adclossless.c -o adclossless -lvme
/tmp/cc5q5khk.o(.text+0x270): In function `main':
: warning: the `gets' function is dangerous and should not be used.

I was also able to start the program.

[root@wahcrate koto]# ./adclossless 

 *************************************************** 
 *****     Beam Test Program for FADC Board     **** 
 *************************************************** 

(Slot:4 type:"none")>>help


    Commands:   read 
    Commands:   write    < value> 
    Commands:   read_vme  slot_number address 
    Commands:   write_vme slot_number address value 

    Commands:   run lb  <2.5, 3.125> 
    Commands:   run dc  
    Commands:   run db  
    Commands:   run ec  
    Commands:   run rnt  

    Commands:   reset_reg     
    Commands:   set slot_number   <1-21>
    Commands:   show
    Commands:   Exit,exit,q 


(Slot:4 type:"none")>>q

Unfortunately, at this point, I have no idea if it will work, since I don’t know how to use it. I will wait and see if it works for the student.

Commands to use to partition a new 3TB disk with parted.

[ ~]# parted /dev/sdg
GNU Parted 2.1
Using /dev/sdg
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Error: /dev/sdg: unrecognised disk label                                  
(parted) mklabel gpt                                                  
(parted) mkpart primary ext3 1 -1                                         
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? C                                                          
(parted) print                                                            
Model: ASMT 2105 (scsi)
Disk /dev/sdg: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart                                                           
Partition name?  []?                                                      
File system type?  [ext2]? ext3                                           
Start? 0%                                                                 
End? 100%

Using percentages worked better than trying to specify the start/stop sectors. Not sure why.

[ ~]# mkfs.ext3 /dev/sdg1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183148544 inodes, 732566272 blocks
36628313 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
22357 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544

[ ~]# tune2fs -c0 -i0 /dev/sdg1

I installed the following packages first. (I’ll add these to my kickstart file so they’re always installed.)

yum install python-devel \
python-imaging \
python-imaging-devel \
python-tools

My configure command:

./configure --with-python-incdir=/usr/include/python2.4 --with-python-libdir=/usr/lib64 --enable-qt --prefix=/code/root_v5.34.18_rhel5

When this finished, I just ran:

make -j2
make install

The -j2 basically means can use two cores on the cpu for ROOT. Probably could have done -j4, but thought I’d start with -j2 and see how it goes.

Next need to set the following environment variables:

export ROOTSYS=/code/root_v5.34.18_rhel5
export PATH=$PATH:$ROOTSYS/bin
export PYTHONPATH=$ROOTSYS/lib/root:/usr/lib/python2.4:/usr/bin/python
export LD_LIBRARY_PATH=$ROOTSYS/lib

To see what features are installed, can use:

$ root-config --features
asimage astiff builtin_afterimage builtin_ftgl builtin_glew builtin_pcre builtin_lzma cintex explicitlink genvector memstat opengl python reflex shadowpw shared tmva vdt x11 xft thread

TEST THAT IT’S INSTALLED CORRECTLY
In ROOT:

root [0] gSystem->Load("libPyROOT")
(int)0
root [1] TPython::Exec("print 1+1")
2
(Bool_t)1

In python:

>>> import ROOT
>>> import MH
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named MH

(No errors for ROOT is what we want.)

As root, run activate_matlab.sh to start the activation process. You may have to first login to the mathworks account and set up the new computer.

If Matlab is very slow to start or stuck in the initializing state or unable to quit, it could be because the LM_LICENSE_FILE is set. And it’s usually set because other programs need it set, so the solution of deleting that variable won’t work. Instead, change the shortcut that starts the program to:

C:\MATLAB\R2013b\matlab.exe -c "C:\MATLAB\R2013b\licenses\license_file.dat"

That will cause it to just look at the license file specified and not do anything with LM_LICENSE_FILE.

[root@cps4 ~]# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: LSI 9750-8i DISK (scsi)
Disk /dev/sda: 12.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes                                                               
(parted) mkpart primary 0 -0                                              
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Cancel                                                     

(parted) mkpart primary ext3 1 -1
(parted) print                                                            
Model: LSI 9750-8i DISK (scsi)
Disk /dev/sda: 12.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  12.0TB  12.0TB               primary

[root@cps4 ~]# mkfs -t ext3 /dev/sda1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
732422144 inodes, 2929670656 blocks
146483532 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
89407 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
	102400000, 214990848, 512000000, 550731776, 644972544, 1934917632, 
	2560000000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@cps4 ~]# tune2fs -c0 -i0 /dev/sda1
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

Matt requested that /proc/sys/vm/overcommit_memory is set to 2 on some nodes. To do this, edit /etc/sysctl.conf. To the end of the file, add this line:

vm.overcommit_memory = 2

To make it take effect without rebooting, run:

sysctl -p

To determine which version of a python package using, import the package and then check the version. Something like this:

>>> import matplotlib
>>> matplotlib.__version__
'1.2.0'

We were missing the tkinter package on some of our systems and this was causing a problem with matplotlib. You could see the error by running these commands:

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
Traceback (most recent call last):
 File "", line 1, in 
 File "/usr/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 97, in 
   _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
 File "/usr/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
   globals(),locals(),[backend_name])
 File "/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 11, in 
   import matplotlib.backends.tkagg as tkagg
 File "/usr/lib64/python2.6/site-packages/matplotlib/backends/tkagg.py", line 2, in 
   from matplotlib.backends import _tkagg
ImportError: cannot import name _tkagg

The solution was to install the tkinter package (yum install tkinter) and then recompile matplotlib so that it used tkinter.

$ python setup.py build
$ python setup.py install

After that, the same commands as above worked fine.