Showing posts with label MacBookPro. Show all posts
Showing posts with label MacBookPro. Show all posts

2/15/2014

Choosing a python bundle for PyROOT

After played with python 2.7 for a while, I got a need for ROOT drawings. So, I decided to try PyROOT which was supposed to be installed already in my ROOT 5.34.09 installation:

% port -v installed root
The following ports are currently installed:
  root @5.34.09_1+graphviz+gsl+minuit2+opengl+python27+roofit+soversion+ssl+tmva+xml (active) platform='darwin 12' archs='x86_64'

OK, python27 is there. But my python told

% python -c "import ROOT"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named ROOT

Well, PyROOT needs two files, ROOT.py and libPyROOT.so which must be visible from python. Where are they?
% port contents root | grep ROOT.py
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ROOT.py
% port contents root | grep libPyROOT.so
  /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/libPyROOT.so
  /opt/local/lib/root/libPyROOT.so

OK, you guys are there. But when I make these guys visible (by copying or symbolic links) from python, it told

% python -c "import ROOT"
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

What's wrong? After for a while, I found the bundle of python which I was using did not fit with the guy libPyROOT.so, who came through macport. To use this guy, I need to switch my python to the one came also from macport. This one was installed as /opt/local/bin/python2.7, and

%/opt/local/bin/python2.7 -c "import ROOT"

Passed!  What is the difference between 'em?

%/usr/bin/python
Python 2.7.5 (default, Aug  1 2013, 01:01:17)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin

%/opt/local/bin/python2.7
Python 2.7.5 (default, Aug 25 2013, 00:04:04) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin

Well, well, well. I can set my default python as the later one by, for instance,
sudo ln -s /opt/local/bin/python2.7 /opt/local/bin/python
and exporting PATH with /opt/local/bin placed earlier than /usr/bin so that I can just write, e.g.

%python -c "from ROOT import TCanvas"

10/28/2013

gcc and gfortran on OS X 10.9 Marvericks

A new release of OS X 10.9 Marvericks was installed on my MacBook 15-inch Retina Pro 2012.
I kept all softwares previously installed on OS X 10.8 as they were. All of them are working
well without a change except for the following.

gcc 4.8.1
========
I needed to install the Command Line Tools by issuing 
%xcode-select --install
to make gcc work. This is necessary regardless whether one has
already installed Xquartz or not.

gfortran
=========
I need
-fno-underscoring
option at the load time to use gnu extensions. 
This was not required before in my case.

10/17/2013

How to make PDF v1.6 files comprisable in LaTeX?

 This issue may concern when you are using TeX Live distribution of dvipdfmx.

It is a common problem that PDF v1.6 files are not comprisable in LaTeX sources to produce PDF outputs using dvipdfmx. This problem occurs due to a line at the beginning of a file dvipdfmx.cfg that reads

V 5

which specify the output PDF version to be 1.5. The problem is fixed by just replacing this line by

V 6

The file dvipdfmx.cfg is placed in <distribution>/texlive/<version>/texmf-config/dvipdfmx for typical cases of TeX Live distributions.

I encountered this problem in TeXShop with ptex2pdf for Japanese writing and found the file in the directory with <distribution> = /usr/local and <version> = 2013.

8/16/2013

Geant 4.9.6 p02 installation


I use macports to install supplemental softwares:

sudo port -v install cmake (necessary)
sudo port -v install iAIDA (optional, I was just curious)
sudo port -v install xercesc3 (needed for GDML)
sudo port -v install qt4-mac +demos +examples (optional. This takes very long.)


I downloaded the newest available source from cern Source Download Page.
I am going to install it in /usr/local/geant4:

$ sudo mkdir /usr/local/geant4
$ cd /usr/local/geant4
$ mkdir build4.9.6.p02
$ sudo mv  ~/Downloads/geant* ./
$ sudo tar -xvf geant4.9.6.p02.tar
$ cd build4.9.6.p02

$ls -lO /
$sudo chflags nohidden /usr (to see files on finder)
$export G4INSTALL=/usr/local/geant4/geant4.9.6.p02
Now we use cmake
$sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DXERCESC_ROOT_DIR=/opt/local -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON $G4INSTALL
For build options, refer to section 2.3 in ‎geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/fo/BookInstalGuide.pdf

Now proceed usual make:
$sudo make -j4
$sudo make install

$ls -lO /
$sudo chflags hidden /usr (to hide /usr from finder)

Build an example application:
$cd /my/private/directory
$mkdir B1-build
$cd B1-build
$source /usr/local/bin/geant4.sh
$cmake -DGeant4_DIR=/usr/local/lib/Geant4-9.6.2 $G4INSTALL/examples/basic/B1
$make
$./exampleB1

Build another example which requires a slight different targeting:
$cd ..
$mkdir rdecay01-build
$cd rdecay01-build
$cmake -DGeant4_DIR=/usr/local/lib/Geant4-9.6.2 $G4INSTALL/examples/extended/radioactivedecay/rdecay01

That's it.

#This installation was performed after an unsuccessful installation of a macports distribution of geant4.9.4 by

$sudo port -v install geant4 +aida +gdml +raytracerx

Precisely speaking, the installation process was successful. However, when I try to build an example, clang called in Darwin-g++.gmk couldn't find files such as libgcov.a in my OS X 10.8 system to generate a library. I therefore uninstalled the macports distributed geant4.9.4.p02 from my system.

8/13/2013

Makefile for my c++ lib with ROOT

For later reference, I put my Makefile in the following.


#===========================================================
#
##        The Standard Makefile
#
#(Usage)
# make U=<program_name>;  for compiling a single program
#              <program_name> = bar for bar.cpp
# make ; for compiling all (listed below all:)
#
#(Default Library) ROOT
#
#(History)
# 130813 updated
#===========================================================
main:
make library
make compile PROGRAM=$(U)

all:
make compile_all PROGRAM=testReadAData
make compile_all PROGRAM=testA2RT
make compile_all PROGRAM=testReadTTree
make compile_all PROGRAM=testSetDoPrm

WRKDIR = tmp
ULIBOBJS    = ReadAData-v03.2.o \
              A2RT-v03.5.o \
              ReadTTree-v03.3.o \
              SetDoPrm-v01.8.o

LIBRARY_NAME     = mycpplib
LIBRARY          = lib${LIBRARY_NAME}.a

ULIBDIR = /My/cpplib/is/here

#====================================================
### INCLUDES ###
include /opt/local/etc/root/Makefile.arch
INCLUDE = -I/opt/local/include
#------ include user headers
ULIBINC = -I$(ULIBDIR)/include -Iinclude -I.
INCLUDE := $(INCLUDE) $(ULIBINC)

### LIBS ###
LIBS := -L./ -l${LIBRARY_NAME} $(ROOTGLIBS) -L/opt/local/lib -lgsl

UOBJS    = <list your objects to be linked>
UOBJS    =

LANGSFX=cpp
COMPILER = g++
LINKER = g++

COMPOPT = $(ROOTCFLAGS)
LINKOPT =
GOPTION = -DDEBUG
#====================================================
SRC         = $(PROGRAM).$(LANGSFX)
OBJ         = $(PROGRAM).o

TARGET    = $(PROGRAM)_cxx

LDFLAGS    = $(LIBS)

COMPOPT := $(COMPOPT) $(GOPTION)
LINKOPT := $(LINKOPT) $(GOPTION)

LIBSRCS = $(addprefix $(WRKDIR)/,$(ULIBOBJS))

ULIBSRC = $(ULIBDIR)/src
UOBJDIR = $(WRKDIR)
UOBJS := $(addprefix $(UOBJDIR)/,$(UOBJS))
#----------------------------------------------------
library:
@if [ ! -d $(WRKDIR) ]; then mkdir $(WRKDIR); \
echo "## --> tmp/ created...";fi
rm -f ${LIBRARY}
rm -f ${LIBSRCS}
make ${LIBRARY}

${LIBRARY}: ${LIBSRCS}
ar cru $@ ${LIBSRCS}
ranlib $@

compile:
@if [ -f $(SRC) ]; \
then make $(TARGET); \
rm $(OBJ); \
else make all; fi

compile_all:
rm -f $(TARGET)
make $(TARGET)
rm $(OBJ)
#----------------------------------------------------

.SUFFIXES: .exe .f .c .o .a .cpp .cxx .cc

#=================================================  
$(TARGET):  $(OBJ) $(UOBJS)
$(LINKER) $(LINKOPT) $(OBJ) $(UOBJS) -o $@ $(LDFLAGS)

$(ROOTLINKSRC)Dist.cpp: $(ROOTGUIHDRS).h $(ROOTLINKSRC)LinkDef.h
rootcint -f $(WRKDIR)/$(ROOTLINKSRC)Dist.cpp -c $(INCLUDE) $(ROOTGUIHDRS).h $(ROOTLINKSRC)LinkDef.h

#The following line must be the first one
$(UOBJDIR)/%.o :  $(UOBJDIR)/%.cpp
$(COMPILER) -c $(COMPOPT) $< $(INCLUDE) -o $@

$(UOBJDIR)/%.o :  $(ULIBSRC)/%.cpp
$(COMPILER) -c $(COMPOPT) $< $(INCLUDE) -o $@

$(UOBJDIR)/%.o :  src/%.cpp
$(COMPILER) -c $(COMPOPT) $< $(INCLUDE) -o $@

$(UOBJDIR)/%.o :  %.cpp
$(COMPILER) -c $(COMPOPT) $< $(INCLUDE) -o $@

.f.o:
$(FCOMPILE) -c $(FCMPOPT) $(FINCLUDE) $<

.c.o:
$(CCOMPILE) -c $(CCMPOPT) $(CINCLUDE) $<

My c++ library with ROOT: test run

 A Makefile to compile my c++ library with ROOT is adjusted for the new environment. A flag -m32 is removed, an include path for Makefile.arch is changed for the new ROOT set (which I needed to look for in /opt/local/etc,) a link path for gsl is explicitly added. (Specifying  LD_LIBRARY_PATH in ~/.bashrc did not work. My make processes seem not referring to this env. variable.)
 All sample programs included in my library were complied with ROOT and run without any problem. I was expecting some mysterious problems occur to bother me. But no mysterious thing happen. It's I call a miracle!

8/12/2013

Preparing for numerical works

After moved from the old 32-bit mode mac, the first thing to do is to recompile sources of my private c++ library with gcc without -m32 flag. This step is going well and will be finished in 3 hours.

ROOT 5.34.09 installation

I install ROOT on my new MacBookPro via MacPorts (MacPorts Guide).

$ sudo port -v selfupdate
$ port info root
$ gcc --version
   4.2.1
$ python --version
  2.7.2

$sudo port -v install root +graphviz +gsl +minuit2 +opengl +python27 +roofit +soversion +ssl +tmva +xml
...
/usr/bin/clang++ -02 -m64 ...
...


Installation process finished.

disk space occupied = 3.87 GB
$ root
ROOT 5.34/09 (v5-34-09@v5-34-09, Jun 26 2013, 17:10:36 on macosx64)


$ port installed
The following ports are currently installed:
  bzip2 @1.0.6_0 (active)
  cairo @1.12.14_0+opengl+x11 (active)
  db46 @4.6.21_8 (active)
  db_select @0.1_2 (active)
  expat @2.1.0_0 (active)
  fontconfig @2.10.93_0 (active)
  freetype @2.5.0_1 (active)
  gd2 @2.0.35_14 (active)
  gdbm @1.10_2 (active)
  gettext @0.18.3_0 (active)
  giflib @4.2.1_0+x11 (active)
  glib2 @2.36.4_0 (active)
  gmp @5.0.5_0 (active)
  gobject-introspection @1.36.0_1 (active)
  graphite2 @1.2.3_0 (active)
  graphviz @2.32.0_0+pangocairo+x11 (active)
  gsl @1.15_2 (active)
  gts @0.7.6_2 (active)
  harfbuzz @0.9.19_0 (active)
  jasper @1.900.1_10 (active)
  jbigkit @2.0_2 (active)
  jpeg @9_1 (active)
 libedit @20121213-3.0_0 (active)
  libffi @3.0.13_0 (active)
  libiconv @1.14_0 (active)
  libLASi @1.1.1_0 (active)
  libpixman @0.30.2_0 (active)
  libpng @1.5.17_0 (active)
  libtool @2.4.2_3 (active)
  libxml2 @2.9.1_0 (active)
  lzo2 @2.06_0 (active)
  mesa @8.0.4_2+python27 (active)
  ncurses @5.9_2 (active)
  netpbm @10.62.02_0 (active)
  nkf @2.1.3_2 (active)
  openssl @1.0.1e_1 (active)
  pango @1.34.1_1+x11 (active)
  pcre @8.33_0 (active)
  perl5 @5.12.4_0+perl5_12 (active)
  perl5.12 @5.12.4_2 (active)
  pkgconfig @0.28_0 (active)
  python27 @2.7.5_1 (active)
  python_select @0.3_2 (active)
  root @5.34.09_1+graphviz+gsl+minuit2+opengl+python27+roofit+soversion+ssl+tmva+xml (active)
  sqlite3 @3.7.17_0 (active)
  tiff @4.0.3_1 (active)
  urw-fonts @1.0.7pre44_0 (active)
  webp @0.3.1_0 (active)
  Xft2 @2.3.1_0 (active)
  xorg-dri2proto @2.8_0 (active)
  xorg-fixesproto @5.0_0 (active)
 xorg-glproto @1.4.16_0 (active)
  xorg-inputproto @2.3_0 (active)
  xorg-kbproto @1.0.6_0 (active)
  xorg-libice @1.0.8_0 (active)
  xorg-libpthread-stubs @0.3_0 (active)
  xorg-libsm @1.2.1_0 (active)
  xorg-libX11 @1.6.1_0 (active)
  xorg-libXau @1.0.8_0 (active)
  xorg-libXaw @1.0.11_0 (active)
  xorg-libxcb @1.9.1_0+python27 (active)
  xorg-libXdmcp @1.1.1_0 (active)
  xorg-libXext @1.3.2_0 (active)
  xorg-libXfixes @5.0.1_0 (active)
  xorg-libXi @1.7.2_0 (active)
  xorg-libXmu @1.1.1_0 (active)
  xorg-libXt @1.1.4_0 (active)
  xorg-renderproto @0.11.1_0 (active)
  xorg-xcb-proto @1.8_0+python27 (active)
  xorg-xcb-util @0.3.9_0 (active)
  xorg-xextproto @7.2.1_0 (active)
  xorg-xproto @7.0.24_0 (active)
  xpm @3.5.10_0 (active)
  xrender @0.9.8_0 (active)
  xz @5.0.5_0 (active)
  zlib @1.2.8_0 (active)

5/09/2013

My MacBookPro arrived

But I am too much involved in a pile of jobs and I'll not open the box until I finish them.

4/10/2013

Plan for a new MacBookPro: Writing specification

When we have a plan to purchase something, our administrators require us to write a specification to open for a bidding. I can not, however, just write "I want a MacBook Pro quad-core Intel Core i7, 2.8 GHz model." They don't accept names of commercial products and I can not use words like "Mac" nor "Intel". They accept only descriptions of characteristics which I need for my purpose. So, only "quad-core" and "2.8 GHz" are accepted in the sentence above. This is something like

namespace admin{

class Specification{

     public:
        Specification & cpu_arch(std::string const& arg);
        Specification & cpu_speed(double const& arg);
        Specification & memory_size(double const& arg);
        Specification & memory_speed(double const& arg);
        Specification & storage_size(double const& arg);
       ........
};

} // admin namespace

to use it as

using namespace admin;

Specification I_want_a_MacBookPro(
          Specification.cpu_arch(X86-64)
                            .cpu_speed(2.8)
                            .memory_size(16)
                            .memory_speed(1.6)
                            .storage_size(512));


4/09/2013

Plan for a new MacBookPro: Budget

I want the swiftest system with large enough memory and disk space. Therefore, it is straightforward for me to choose the high end model: 2.7 GHz quad Intel i7 with 16GB, 1.6 GHz memory and 512GB flash storage. I'm going to use it in the clamshell mode connecting to my old display and my lovely HappyHack keyboard. This means I don't need an excellent 15" Retina display. But it comes with anyway. OK, I'll take it. Cost = J¥245,800.

 I take an upgrade of the quad i7 to 2.8 GHz. Cost+= J¥22,800.

I don't take an option to increase the capacity of the flash storage. 512 GB is enough.

I need a Mini DisplayPort-VGA to connect to my display. Cost+=J¥2,800

I should have a Time Capsule. 2TB is enough, I think. Cost+=J¥26,400

Cost: J¥297,800 (Apple Store)

(Why I want a brand new MacBookPro?)
My current MacBookPro: Intel Core 2 Duo 2.8 GHz with 4GB memory. OS X 10.6.8. Used to be good enough for my purpose. I am just beginning to feel the limit of capacity when I run my 10K line c/c++ routine including root and geant4 libraries. More important is that I have installed these libraries in 32 bit mode. Why? Because CLHEP2 used in geant4 was only available for 32 bit. The real limitation with my MacBookPro is not of the hardware one. Some libraries like xmlrpc, when I use it to communicate with my computing environments, dosen't allow me to use 32 bit mode compiled with gcc -m32. So, I apparently need 64 bit environment somewhere at my hand. In principle, I can install 64 bit versions separately on my current Mac. But I don't want to get a mess like ones I have experienced in the past. I want to leave all 32 bit libraries working on the current MacBookPro and want a new 64 bit platform.