On a per machine basis, some `profile` initialisations files run even when 
your login shell is used (ie even if a command is specified in the SSH 
parameter, i.e. even when starting julia workers),
where as others only run if you start a shell script or an interactive 
shell (rc) 
If your default shell (on the remote machines) is bash,
then setting the environment variable JULIA_NUM_THREADS in your 
`~./bash_profile` rather than in `~./.bashrc` will make it work.

See
http://stackoverflow.com/questions/415403/whats-the-difference-between-bashrc-bash-profile-and-environment

Another hack, if you really want to specify it from julia would be to make 
a function that reads your `~/.ssh/enviroment` file, and then appends 
`export JULIA_NUM_THREADS=$n`,
then calls addproc, and then when does replaced the file with its original 
content.
(Use `tryfinally`)

But these are just hacks til the issue is done.

---



On Wednesday, 17 August 2016 18:52:33 UTC+8, Oliver Schulz wrote:
>
> Sure, but *how* do I preset JULIA_NUM_THREADS in the environment of the 
> workers? It'll still be application dependent, so it can be in a .profile 
> or so (which probably won't be run anyway for the worker processes).
>
> On Wednesday, August 17, 2016 at 12:00:16 PM UTC+2, Jeffrey Sarnoff wrote:
>>
>> Hi Oliver,
>>
>> I omitted two letters "the environment" should have been "their 
>> environment":
>> "and in [each of] *their* [remote] enviroment[s] JULIA_NUM_THREADS had 
>> been preset [in each remote environment before each remote Julia had been 
>> started]..
>>
>> from in the REPL ?addprocs
>> " Note that workers do not run a .juliarc.jl startup script, nor do they
>>   synchronize their global state (such as global variables, new method 
>> definitions,
>>   and loaded modules) with any of the other running processes."
>>
>>      so it seems environment variables are one of those nonsynced things
>>
>> -- Jeffrey
>>
>>
>> On Wednesday, August 17, 2016 at 5:17:53 AM UTC-4, Oliver Schulz wrote:
>>>
>>> Hi Jeff,
>>>
>>> > If your remote workers are remotely local invocations of Julia and in 
>>> the environment JULIA_NUM_THREADS has been preset, then the remote workers 
>>> will be using that many threads
>>>
>>> I tried it, and at least when the workers are started via SSH (using 
>>> addprocs([host1, ...])), that doesn't seem to be the case, 
>>> JULIA_NUM_THREADS 
>>> doesn't seem to be passed on. It would actually be very helpful to be 
>>> able to forward (or explicitly set) environment variables for remote 
>>> workers.
>>>
>>> Cheers,
>>>
>>> Oliver
>>>
>>>
>>> On Wednesday, August 17, 2016 at 12:16:11 AM UTC+2, Jeffrey Sarnoff 
>>> wrote:
>>>>
>>>> Hi Oliver,
>>>> As I understand it:
>>>> JULIA_NUM_THREADS is an environment variable read by the local 
>>>> invocation of Julia.  It is not a run-time passable value. If your remote 
>>>> workers are remotely local invocations of Julia and in the environment 
>>>> JULIA_NUM_THREADS has been preset, then the remote workers will be using 
>>>> that many threads (if the have the cores).
>>>>
>>>>
>>>> On Tuesday, August 16, 2016 at 11:52:20 AM UTC-4, Oliver Schulz wrote:
>>>>>
>>>>> I guess the answer is "no", then?
>>>>>
>>>>> On Monday, August 1, 2016 at 3:26:17 PM UTC+2, Oliver Schulz wrote:
>>>>>>
>>>>>> Is it possible to pass on or explicitly set JULIA_NUM_THREADS for 
>>>>>> remote workers started via
>>>>>>
>>>>>> addprocs([host1, ...])
>>>>>>
>>>>>> ?
>>>>>>
>>>>>>

Reply via email to