Setting an environmental variable - Suse

This is a discussion on Setting an environmental variable - Suse ; I need to set an environmental variable, OMP_NUM_THREADS, for an application I use. So I created the file, /etc/profile.local, containing the following line: export OMP_NUM_THREADS=2 My understanding is that this should execute when I log in. But after loggin in, ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Setting an environmental variable

  1. Setting an environmental variable

    I need to set an environmental variable, OMP_NUM_THREADS, for an
    application I use. So I created the file, /etc/profile.local,
    containing the following line:

    export OMP_NUM_THREADS=2

    My understanding is that this should execute when I log in. But after
    loggin in, if I open a command windows and type

    'echo $OMP_NUM_THREADS'

    to check, it returns nothing. What am I doing wrong?

    Thanks for the help. -Pat

  2. Re: Setting an environmental variable

    Pat wrote:
    > I need to set an environmental variable, OMP_NUM_THREADS, for an
    > application I use. So I created the file, /etc/profile.local,
    > containing the following line:
    >
    > export OMP_NUM_THREADS=2
    >
    > My understanding is that this should execute when I log in. But after
    > loggin in, if I open a command windows and type
    >
    > 'echo $OMP_NUM_THREADS'
    >
    > to check, it returns nothing. What am I doing wrong?
    >
    > Thanks for the help. -Pat


    Try putting it in your ~.bashrc or ~.bash_profile.
    (assuming you use the bash shell)
    --
    Dawid Michalczyk - Cool 3D wallpapers:
    http://www.art.eonworks.com/free/wal...wallpaper.html

  3. Re: Setting an environmental variable

    Dawid Michalczyk wrote:
    > Pat wrote:
    >> I need to set an environmental variable, OMP_NUM_THREADS, for an
    >> application I use. So I created the file, /etc/profile.local,
    >> containing the following line:
    >>
    >> export OMP_NUM_THREADS=2
    >>
    >> My understanding is that this should execute when I log in. But after
    >> loggin in, if I open a command windows and type
    >>
    >> 'echo $OMP_NUM_THREADS'
    >>
    >> to check, it returns nothing. What am I doing wrong?
    >>
    >> Thanks for the help. -Pat

    >
    > Try putting it in your ~.bashrc or ~.bash_profile.
    > (assuming you use the bash shell)


    Thanks. That worked.

    I may also have forgotten to change the permissions on the file so it
    could be executed. I'm not sure. But what you suggested worked,
    regardless.

    Thanks again. -Pat

  4. Re: Setting an environmental variable

    On 2007-07-27 02:30, Pat wrote:
    > Dawid Michalczyk wrote:
    >> Pat wrote:
    >>> I need to set an environmental variable, OMP_NUM_THREADS, for an
    >>> application I use. So I created the file, /etc/profile.local,
    >>> containing the following line:
    >>>
    >>> export OMP_NUM_THREADS=2
    >>>
    >>> My understanding is that this should execute when I log in. But after
    >>> loggin in, if I open a command windows and type
    >>>
    >>> 'echo $OMP_NUM_THREADS'
    >>>
    >>> to check, it returns nothing. What am I doing wrong?
    >>>
    >>> Thanks for the help. -Pat

    >> Try putting it in your ~.bashrc or ~.bash_profile.
    >> (assuming you use the bash shell)

    >
    > Thanks. That worked.
    >
    > I may also have forgotten to change the permissions on the file so it
    > could be executed. I'm not sure. But what you suggested worked,
    > regardless.
    >
    > Thanks again. -Pat


    All applications that require special setting in the users profile
    are broken, bad designed , ported from windows.

    It can work if you do it at home and only have a few of them, but
    on big sites that have hundreds or more applications, you can't set
    environment for each of them since your shell will be so slow so you can't
    work, or they start to create conflicts with each other.
    One horrible example is LD_LIBRARY_PATH , if you change that as your
    application vendor say, you must have one account for each application,
    or a broken system.

    If you have a broken application that require some special setting, make
    a wrapper for it.

    That is, don't have your application in your search path, or rename it.

    Create a executable wrapper somewhere in your search path, named as the application.

    Add shebang for the shell, ex: #!/bin/bash
    add the environment , ex: export OMP_NUM_THREADS=2
    add the name of the real program, ex: pgm="/local/myapp"
    then start it , ex: exec "$pgm" "$@"

    Suse are using this by sourcing profiles from /etc/sysconfig/
    so wrappers and scripts use this, so you have everything on one place
    in reach for YaST sysconfig editor

    Which file did you forgot to set permission for?
    your .bashrc and .bash_profile should not be executed, since that will
    create a new shell, you must source them ( . .bashrc) , and that only require
    read permission.

    There is a big chance that your "application" already is a wrapper,
    do file $(which ) and see if this is a script that later exec some
    binary somewhere.
    In this case, just add the environment there.
    If it's made for SuSE, you could even have a line with
    .. /etc/sysconfig/ ready to use for environment variables.

    /bb

  5. Re: Setting an environmental variable

    birre ha scritto:
    > Create a executable wrapper somewhere in your search path, named as the
    > application.


    You have no idea what you are talking about: the OMP_NUM_THREADS
    variable is used by runtime libraries of intel MKL. They are not shell
    script, and not even executable programs; just shared libraries. So
    adding a shabang at the beginning may have quite unpredictable results ;-).

    bye

    --
    Lorenzo `paulatz' Paulatto
    Trieste

    ``Grandissima mi par l'inezia di coloro che vorrebbero che Iddio avesse
    fatto l'universo pił proporzionato alla piccola capacitą del lor discorso.''
    --Galileo Galilei (Opere VII)

+ Reply to Thread