Difference between revisions of "ForestMacStuff"

From New IAC Wiki
Jump to navigation Jump to search
Line 183: Line 183:
 
Lets first build the distribution without any graphics to be sure the bare bones are working
 
Lets first build the distribution without any graphics to be sure the bare bones are working
  
then typ
+
then type
  
 
./Configure install
 
./Configure install
Line 214: Line 214:
 
<pre>
 
<pre>
  
=fork: Resource temporarily unavailable=
 
<pre>
 
 
solution from
 
 
http://www.macosxhints.com/article.php?story=200311151254441
 
 
I work with Terminal a lot, and often have 30 to 40 windows open, each running my shell and ssh. Add in all the other processes, and I quickly exceed the 100 maxprocperuid limit that OS X defaults to.
 
There have been many proposed solutions to this. You can, for instance, in your shell startup scripts override the limit for that shell instance, and you can run more than 100 processes from that shell, but when you launch a new window, the parent process that launches all apps for you in the GUI is still limited to that 100 process per user limit, and the new window will fail to launch your shell. It usually fails with the error: login: fork: Resource temporarily unavailable.
 
 
There are two phases to fixing this problem. First you must change the overall OS limits for maxproc and maxprocperuid to higher values, and then you must make WindowServer run in an environment with the limits raised.
 
 
[robg adds: I have not tested this one, nor do I intend to! If you're going to experiment with it, I recommend you have a good backup first, just in case...]
 
 
System Wide
 
OS X 10.3 now supports the standard /etc/sysctl.conf. This means you can just put new values into this file and reboot. This is what the file looks like:
 
 
% cat /etc/sysctl.conf <br>
 
# Turn up maxproc <br>
 
kern.maxproc=2048 <br>
 
 
# Turn up the maxproc per user <br>
 
kern.maxprocperuid=512 <br>
 
Daemons /etc/rc.common
 
All of the daemons that are started via /System/Library/StartupItems are started with the default maxproxperuid of 100. This might not normally be a problem, as root may not run a ton of processes, but it does matter when sshd is started up. On OS X, sshd is started out of xinetd. A quick way to affect the environment of xinetd, and all other daemons as well, is to put ulimit -u 512 at the top of /etc/rc.common. If you preferred, you could just edit the startup script for xinetd instead, which is in /System -> Library -> StartupItems -> IPServices -> IPServices.
 
Here is a snippet of the top of my /etc/rc.common file:
 
 
#######################
 
# Configure the shell #
 
#######################
 
 
ulimit -u 512
 
 
##
 
# Be strict
 
##
 
WindowServer
 
Every process you run from the GUI is launched by WindowServer. So we need to make WindowServer launch in such a way that it has its limits raised. I cannot determine what actually launches WindowServer. Its parent process is mach_init, and I can find no way to modify how it is launched directly. You can, however, write a wrapper script for WindowServer. This is a shell script that is launched instead of WindowServer itself which sets the limits properly, then launches the original WindowServer as normal.
 
Become root on command line.
 
 
% cd /System/Library/Frameworks/
 
% cd ApplicationServices.framework/Frameworks/
 
% cd CoreGraphics.framework/Resources/
 
robg adds: Yes, you can do that as one long cd command; I snipped it apart for narrower display width.
 
 
Type mv WindowServer WindowServer.orig
 
 
Type vi WindowServer ... below is the script I used; the last two lines should be entered as one long line with no extra spaces in it:
 
#!/bin/zsh
 
ulimit -u 384
 
/System/Library/Frameworks/ApplicationServices.framework/
 
Frameworks/CoreGraphics.framework/Resources/WindowServer.orig $*
 
Type chmod a+rx WindowServer
 
 
Type reboot
 
How I Tested
 
To quickly test if my solution was working I ran a bunch of sleep0 processes in the background. This was able to reproduce the problem for me on demand before the fix. I'd open one shell window, launch over 100 sleeps, and then try to launch a new Terminal window, and it would fail. After the fix, it works.
 
 
the type
 
 
rehash
 
exampleN01
 
 
</pre>
 
 
=== Configure -build  (with visualization) ===
 
 
Now lets build everything again except this time turn on the graphics
 
 
 
Your choices are Motif, OpenGL, Dawn, OpenInventor
 
 
You need to install the Coin and the Motif Libraries
 
 
sudo port install Coin
 
sudo port install SoXt
 
 
 
 
./Configure -build
 
 
====select most of the default and turn on Open GL====
 
 
you should see the variables below have been set
 
 
On this machine the G4VIS_BUILD_OPENGLX_DRIVER=1
 
On this machine the G4VIS_USE_OPENGLX=1
 
 
 
./Configure install
 
 
 
 
now try to compile example N02 as a test
 
 
<pre>
 
[tony-forests-macbook-pro:examples/novice/N02] tforest% make
 
Making dependency for file exampleN02.cc ...
 
Making dependency for file src/ExN02TrackerSD.cc ...
 
Making dependency for file src/ExN02TrackerHit.cc ...
 
Making dependency for file src/ExN02SteppingVerbose.cc ...
 
Making dependency for file src/ExN02SteppingAction.cc ...
 
Making dependency for file src/ExN02RunAction.cc ...
 
Making dependency for file src/ExN02PrimaryGeneratorAction.cc ...
 
Making dependency for file src/ExN02PhysicsList.cc ...
 
Making dependency for file src/ExN02MagneticField.cc ...
 
Making dependency for file src/ExN02EventAction.cc ...
 
Making dependency for file src/ExN02DetectorMessenger.cc ...
 
Making dependency for file src/ExN02DetectorConstruction.cc ...
 
Making dependency for file src/ExN02ChamberParameterisation.cc ...
 
Compiling ExN02ChamberParameterisation.cc ...
 
Compiling ExN02DetectorConstruction.cc ...
 
Compiling ExN02DetectorMessenger.cc ...
 
Compiling ExN02EventAction.cc ...
 
Compiling ExN02MagneticField.cc ...
 
Compiling ExN02PhysicsList.cc ...
 
Compiling ExN02PrimaryGeneratorAction.cc ...
 
Compiling ExN02RunAction.cc ...
 
Compiling ExN02SteppingAction.cc ...
 
Compiling ExN02SteppingVerbose.cc ...
 
Compiling ExN02TrackerHit.cc ...
 
Compiling ExN02TrackerSD.cc ...
 
Creating shared library /Users/tforest/geant4/tmp/Darwin-g++/exampleN02/libexampleN02.dylib ...
 
Creating/replacing object files in /Users/tforest/geant4/tmp/Darwin-g++/exampleN02/libexampleN02.a ...
 
ar: creating archive /Users/tforest/geant4/tmp/Darwin-g++/exampleN02/libexampleN02.a
 
Compiling exampleN02.cc ...
 
Using global libraries ...
 
Linking exampleN02 ...
 
... Done!
 
 
 
[tony-forests-macbook-pro:examples/novice/N02] tforest% rehash
 
[tony-forests-macbook-pro:examples/novice/N02] tforest% exampleN02
 
</pre>
 
 
OhOhh I go a bus error:
 
 
<pre>
 
/vis/scene/add/trajectories
 
/tracking/storeTrajectory 1
 
WARNING: Trajectory storing has been requested.  This action may be
 
  reversed with "/tracking/storeTrajectory 0".
 
/vis/scene/notifyHandlers
 
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
 
# for drawing the hits, uncomment next line
 
# /vis/scene/add/hits
 
# (if you prefer refreshing each event, comment out next line)
 
/vis/scene/endOfEventAction accumulate
 
WARNING: The vis manager will keep up to 100 events.
 
  This may use a lot of memory.
 
  It may be changed with, e.g., "/vis/scene/endOfEventAction accumulate 10".
 
#
 
/run/beamOn 10
 
Bus error
 
 
</pre>
 
 
 
====Let try using openMotif====
 
 
it is store in /opt/local when asked by ./Configure
 
 
<pre>
 
You have selected to use XM Motif based user interfaces.
 
But XM Motif was not found in expected place.
 
Please specify the correct path where Xm is installed in your system.
 
 
 
You can set '-' (without quotation) to CANCEL the XM flag at all:  /opt/local
 
 
</pre>
 
 
turn off the openGL use
 
<pre>
 
  G4VIS_BUILD_OPENGLX_DRIVER
 
  G4VIS_USE_OPENGLX
 
  
It is an interface to the de facto standard 3D graphics library,
 
OpenGL. It is well suited for real-time fast visualization
 
and prototyping. The X11 version of the OpenGL libraries is
 
required.
 
[y] n
 
</pre>
 
  
 
[http://www.iac.isu.edu/mediawiki/index.php/User_talk:Tforest Go Back]
 
[http://www.iac.isu.edu/mediawiki/index.php/User_talk:Tforest Go Back]

Revision as of 22:45, 31 August 2009

setting up wireless

shoose EDUWIFI

Key is 1CBE991A14

neet to send MAC address of card to ISU helpdesk in order to get permission to use

Enabling password requirement when waking from sleep

There is a check box under the "Security" icon within "System Preferences"

setting root password

Mac OS X 10.5 or later

  1. From the Finder's Go menu, choose Utilities.
  2. Open Directory Utility.
  3. Click the lock in the Directory Utility window.
  4. Enter an administrator account name and password, then click OK.
  5. Choose Enable Root User from the Edit menu.
  6. Enter the root password you wish to use in both the Password and Verify fields, then click OK.

Setting up printers

Choose "print" from within any application

Select "Add printer" from the pull down menu

choose "HP Jet Direct - Socket"

Enter IP address of printer

It should auto detect the printer

add a label

Unix utilities

Most of the commands below require that you either be a superuser (su) or have superuser priviledges (sudo)

Xcode

First download Xcode from apple

http://developer.apple.com/TOOLS/xcode/

MacPorts

http://www.macports.org/

installed in /opt/local/bin

do the command

port -d selfupdate

to update ports

some commands


to search for packages use
sudo port search string
to install a package you found do
sudo port install packagename

Installing older port versions

MacPorts is my preferred way of installing, managing, and upgrading much of the software I have on my Mac. I’m setting up a new work machine today and I need to install ruby 1.8.5 on my machine for Rails to be happy. Unfortunately, you can’t do something simple like specifying the version of the port you want to install unless it’s in a local repository. Fortunately, my friend Stephen Chu had this problem about a year ago and has a nice procedure on how to do it. I’m going to update it for MacPorts and ruby 1.8.5 here.

1) Find out the svn revision number of the Portfile that has 1.8.5 by looking at: http://trac.macosforge.org/projects/macports/log/trunk/dports/lang/ruby/Portfile In my case it is 21127.

2) Set up a local port repository. In the file /opt/local/etc/macports/sources.conf, add this line before the rsync line: file:///Users/Shared/dports and create that directory.

3) Install the port into your local repository. cd /Users/Shared/dports && svn co --revision 21127 http://svn.macports.org/repository/macports/trunk/dports/lang/ruby/ lang/ruby/

4) Run portindex so that ports now finds your new (old) version of ruby. portindex /Users/Shared/dports

5) Now you should be able to see ruby @1.8.5-p12 in addition to @1.8.6 by running: port list

6) Install Ruby sudo port install ruby @1.8.5-p12 You should be up and running now, so to check, run: ruby -v You will see something like this: ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.10.1]

SVN

http://subversion.tigris.org/


port install subversion

from command line type

=SVN commands

svn -help


svn info URL

svn co URL

Xmgrace

http://plasma-gate.weizmann.ac.il/Grace/


installation using macports

ports install grace

Xfig

sudo port install xfig

Tex

sudo port install teTex

gerbv

port install gerbv

GEANT4

Installing geant 4.9.2 p01

Get CLHEP 2.0.4.2

http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/

after downloading to a good place "be sure to set the prefix path to where you want to find the CLHEP libraries"

tar -zxvf clhep-2.0.4.2.tgz 
cd 2.0.4.2/CLHEP
./configure  --prefix=/users/tforest/src/GEANT4/CLHEP/2.0.4.2/
make

The above prefix will put the CLHEP libraries under the subdirectory /users/tforest/src/GEANT4/CLHEP/2.0.4.2/

the source code is under the subdirectory /users/tforest/src/GEANT4/CLHEP/2.0.4.2/CLHEP

when asked in the GEANT4 configure script below for the CLHEP_BASE_DIR subdirectory youwill enter /users/tforest/src/GEANT4/CLHEP/2.0.4.2/

unpack data libraries

create a "data" subdirectory under your geant4 directory and untar all the data "tar files

tar -xvf G4NDL.3.13.tar
tar -xvf G4EMLOW.6.2.tar
tar -xvf G4RadioactiveDecay.3.2.tar 
tar -xvf G4ABLA.3.0.tar
tar -xvf PhotonEvaporation2.0.tar

Configure -build (without visualization)

download the geatn 4 distribtuion and untar it

then enter the directory and type

./Configure -build

Lets first build the distribution without any graphics to be sure the bare bones are working

then type

./Configure install

to create the env.csh file which will set up your environmental variables

enter "csh"

compile exampleN01 to check that things are working

[tony-forests-macbook-pro:examples/novice/N01] tforest% cd /Users/tforest/src/GEANT4/geant4.9.2.p01/examples/novice/N01

[tony-forests-macbook-pro:examples/novice/N01] tforest% make
Making dependency for file exampleN01.cc ...
Making dependency for file src/ExN01PrimaryGeneratorAction.cc ...
Making dependency for file src/ExN01PhysicsList.cc ...
Making dependency for file src/ExN01DetectorConstruction.cc ...
Compiling ExN01DetectorConstruction.cc ...
Compiling ExN01PhysicsList.cc ...
Compiling ExN01PrimaryGeneratorAction.cc ...
Creating shared library /Users/tforest/geant4/tmp/Darwin-g++/exampleN01/libexampleN01.dylib ...
Creating/replacing object files in /Users/tforest/geant4/tmp/Darwin-g++/exampleN01/libexampleN01.a ...
ar: creating archive /Users/tforest/geant4/tmp/Darwin-g++/exampleN01/libexampleN01.a
Compiling exampleN01.cc ...
Using global libraries ...
Linking exampleN01 ...
... Done!




Go Back