[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to put (unix) DLMs?



Craig Markwardt <craigmnet@cow.physics.wisc.edu> writes:

> Let's say that I am distributing a package with a DLM.  Of course the
> problem with DLMs is they can be both IDL version-dependent, and
> architecture dependent.  At least mine is. :-) Let's say for the
> moment can make a big library of binary DLM files for all the
> architectures and IDL versions I know about.
> 
> The question is, where should the DLMs?  The nicest place would be the
> IDL binary directory.  Of course that assumes that users have
> permission to put things there.
> 
> Another thought is to have a separate "site" DLM directory.  That
> requires the user to set their IDL_DLM_PATH environment variable
> before running IDL.  This works, unless users are in heterogeneous
> environment (ie, like my lab's), in which case they won't know *which*
> directory to set it to ahead of time.  Sadly, the IDL system variable
> !DLM_PATH cannot be set at runtime, so there is no way to discover it
> on the fly.
> 
> Has anybody else run into this issue?  Should I just assume that users
> will be able to write into their system $IDL_DIR/bin/bin.${arch}
> directory?
> 
> Thanks,
> Craig
> 
> 
> -- 
> --------------------------------------------------------------------------
> Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> --------------------------------------------------------------------------

Hi Craig,

   I've never worked with DLMs, so I can't say if they are also found 
in IDL's normal !PATH. If so, you could use a somewhat more elaborate
startup file which would set the !PATH according to the !VERSION
variable. Please find attached my startup file which collects some
user information etc. then sets up a search path including (1) the
individual user's routines, (2) institute wide libraries, (3) IDL's
library.


   The second solution if you are only dealing with different Unix
flavors (e.g. SOlaris and Linux), is to use uname in your .cshrc or
whatever shell you use. Example:

if ( `uname` == 'SunOS' ) then
   #  echo Sun Workstation                                              
...
   # IDL settings
   setenv LM_LICENSE_FILE /usr/local/rsi/license/license.dat
   source /usr/local/bin/idl_setup
   setenv IDL_STARTUP ~/IDL/idl_startup.pro
...
endif  

if ( `uname` == 'Linux' ) then 
...
endif



Cheers,

Martin



-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
; Preferences file for IDL
; Platform independent version, Martin Schultz 11 March 2001
; (may not work on all platforms yet)
 
; 1. Set filepath delimiter according to platform
 
   dl = '/'      ; Assume Unix as default
   IF !VERSION.OS_FAMILY EQ 'Windows' THEN dl = '\'
   IF !VERSION.OS_FAMILY EQ 'Mac' THEN dl = ':'
 
 
; 2. The IDL main directory (don't change)
 
   idlexedir = !DIR + dl
 
 
; 3. Set default directory for MPI library
 
   idlmpilib='~m218003/home/IDL/lib/'      ; Assume Unix as default
   IF !VERSION.OS_FAMILY EQ 'Windows' THEN idlmpilib=''
   IF !VERSION.OS_FAMILY EQ 'Mac' THEN idlmpilib=''
 
 
; 4. Get user name, login ID and home directory
; (name can be overwritten in users .idlrc file)
 
   name = 'nobody'
   cmd='finger $USER | head -1 | cut -d ":" -f 3'
   IF !Version.OS_Family EQ 'unix' THEN spawn, cmd, r
   IF N_Elements(r) GT 0 THEN name=StrTrim(r,2)
 
   user = strtrim(getenv("USER"),2)
 
   homedir = strtrim(getenv("HOME"),2)
 
 
; 4. Set defaults for other user settings
 
   initials = '..'                         ; The user initials
   email = 'nobody@dkrz.de'                ; The user email address
   idlusrdir = homedir + dl + 'IDL' + dl   ; The user IDL home directory 
   idlusrlib = idlusrdir + 'lib' + dl      ; The IDL user's personal library directory
   USE_OBSOLETE = 0                        ; Use obsolete system library routines
   QUIET = 0                               ; Don't display settings
   !PATH = ''
 
; 5. Define system variable with user information
defsysv, '!USER', { NAME:name,               $
                    INITIALS:initials,       $
                    USERID:user,             $
                    EMAIL:email,             $
                    HOMEDIR:homedir,         $
                    IDLUSRDIR:idlusrdir,     $
                    IDLUSRLIB:idlusrlib,     $
                    IDLMPILIB:idlmpilib   }
                                                 
; 6. Try to locate user's .idlrc file and execute it. If not there, issue warning
usrfile = ( Findfile(homedir+dl+'.idlrc') )[0]
IF usrfile EQ '' THEN print,'%% No .idlrc file found in '+homedir
IF usrfile EQ '' THEN print,'%% Some settings in !USER may not be correct'
cd, current=curdir
cd, homedir
@.idlrc
cd, curdir
 
 
QUIET = Keyword_Set(QUIET)
 
; 7. Build IDL search path
; Normally, users will have defined their own directories in .idlrc so we
; have to append the common libraries to the !PATH variable
 
; 7.1 remember user path settings for status report
UPATH = !PATH
 
; 7.2 MPIfM wide libraries
XPATH = $
        !USER.IDLMPILIB +'martin_schultz:'  +  $
        !USER.IDLMPILIB +'mgs_objects:'     +  $
        !USER.IDLMPILIB +'david_fanning:'   +  $
        !USER.IDLMPILIB +'mark_hadfield:'   +  $
        !USER.IDLMPILIB +'esrg:'            +  $
        !USER.IDLMPILIB +'liam_gumley:'     +  $
        !USER.IDLMPILIB +'jhuapls1r:'       + $
        !USER.IDLMPILIB +'craig_markwardt:' + $
        !USER.IDLMPILIB +'tex2idl:'
 
; Other procedures, no longer in PATH
;       idlusrdir +'objects:' + $
;       idlusrdir +'hiphop:' + $
;       idlusrdir +'gamap:'
;       idlusrdir +'grib:' + $
;       idlusrdir +'grib/gribidl:' + $
 
 
; 7.3 Build path for system routines manually to prevent obsolete coming before lib
;      Omit all example files
 
SPATH = idlexedir + 'lib:' + $
        idlexedir + 'lib/hook:' + $
        idlexedir + 'lib/utilities:' + $
        idlexedir + 'lib/macros:'         ; this is only needed for IDLDE!
 
IF Keyword_Set(USE_OBSOLETE) THEN SPATH = SPATH + idlexedir + 'lib/obsolete:'
 
; 7.4 Compose !PATH system variable
 
!PATH = !PATH + XPATH + SPATH
 
                                                                        
; 8. Report status
 
print,'Welcome '+!USER.NAME
print
IF NOT QUIET THEN print,'The following personal libraries are included in the search path:'
IF NOT QUIET THEN print,UPATH
IF NOT QUIET THEN print,'The following MPI wide libraries are included in the search path:'
IF NOT QUIET THEN print,XPATH
 
 
; 9. Delete local variables
 
DELVAR, name, initials, user, email, homedir
DELVAR, idlusrdir, idlusrlib, idlmpilib, idlexedir, spath, upath, xpath
DELVAR, curdir, dl, r, use_obsolete
 
 
; 10. Increase length of input buffer
!EDIT_INPUT=50
 
 
; 11. Call Liam Gumley's COLORSET routine to ensure
; working colors
COLORSET,decomposed=0, quiet=QUIET
 
 
; 12. Goodbye
IF NOT QUIET THEN print,'Startupfile for user ',!USER.USERID,' processed.'