bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Potential problem with T∆


From: Christian Robert
Subject: Re: [Bug-apl] Potential problem with T∆
Date: Tue, 17 Mar 2015 11:57:23 -0400
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

That code "only" crash when "traced" with T∆Time.

It work perfectly well (never crash) without the trace.

To me it seams it crash at the "⍎what" statement or when it return from it's 
execution.
I will recompile "without" multi-core to see it it's related or not ...

Xtian.

On 2015-03-17 06:42, Juergen Sauermann wrote:
Hi Xtian,

it looks like you are using the multi-core feature of GNU APL.
As *README-8-parallel* says: *Parallel execution is currently experimental*.

I have seen core dumps like those earlier when multi-core was enabled, but have 
not found the reason.
I suspect a bug in the thread synchronization, but I am not sure, The code at 
the point where the crash below occurs
looks rather clean, thats why I believe that some other thread is involved, 
corrupting the memory of the other
threads. If you find a bug in the *Parallel.hh* / *Parallel.**cc* area then 
please let me know.

You can also use the *workspaces/ScalarBenchmark.apl* workspace which uses a 
more precise timing
measurement based on the CPU cycle counter. It also crashes at times, but not 
so often.

/// Jürgen


On 03/17/2015 02:33 AM, Christian Robert wrote:
)load Util
SAVED 2015-03-17 -3:23:11 (GMT-4)
      ∇Time[⎕]∇
    ∇
[0]   z←ncpu Time what;⎕io;start;stop;old_cpu;max_cpu;SYLGet;SYLSet
[1]  ⍝
[2]  ⍝ Define 2 utility functions
[3]  ⍝
[4]   z←⎕FX 'Z←SYLGet what;⎕io;index' '⎕io←1' 'index←((⊂ 
what)≡¨⎕SYL[;1])/⍳↑⍴⎕SYL' 'Z←⎕SYL[index;2]'
[5]   z←⎕FX 'Z←val SYLSet what;⎕io;index' '⎕io←1' 'index←((⊂ 
what)≡¨⎕SYL[;1])/⍳↑⍴⎕SYL' 'Z←⎕SYL[index;2]←val'
[6]  ⍝
[7]  ⍝ Monadic or Diadic call ?
[8]  ⍝
[9]   →(2=⎕NC 'ncpu')/already_set
[10]    ncpu←1 ⍝ Set the default
[11] already_set:
[12]  ⎕io←0
[13]  old_cpu ← SYLGet 'cores used'
[14]  max_cpu ← SYLGet 'cores available'
[15]  ncpu ← ncpu ⌊ max_cpu  ⍝ No more than available ...
[16] ⍝
[17] ⍝ Execute ...
[18] ⍝
[19]  z←ncpu SYLSet 'cores used'
[20]  start ← ¯5↑⎕ts
[21]  ⍎what
[22]  stop  ← ¯5↑⎕ts
[23]  z←old_cpu SYLSet 'cores used'
[24] ⍝
[25] ⍝ Compute execution time
[26] ⍝
[27]  →(stop[0]=start[0])/ok    ⍝ same day
[28]    stop[0]←stop[0]+1       ⍝ day changed
[29] ok:
[30]  start ← 32 24 60 60 1000 ⊥ start
[31]  stop  ← 32 24 60 60 1000 ⊥ stop
[32]  z←(⍕(stop-start)÷1000),' seconds at num core = ',(⍕ncpu),' of ', ⍕max_cpu
    ∇
      Fntb 'Time'
 z←ncpu Time what;⎕io;start;stop;old_cpu;max_cpu;SYLGet;SYLSet
 ⍝
 ⍝ Define 2 utility functions
 ⍝
 z←⎕FX 'Z←SYLGet what;⎕io;index' '⎕io←1' 'index←((⊂ what)≡¨⎕SYL[;1])/⍳↑⍴⎕SYL' 
'Z←⎕SYL[index;2]'
 z←⎕FX 'Z←val SYLSet what;⎕io;index' '⎕io←1' 'index←((⊂ 
what)≡¨⎕SYL[;1])/⍳↑⍴⎕SYL' 'Z←⎕SYL[index;2]←val'
 ⍝
 ⍝ Monadic or Diadic call ?
 ⍝
 →(2=⎕NC 'ncpu')/already_set
   ncpu←1 ⍝ Set the default
 already_set:
 ⎕io←0
 old_cpu ← SYLGet 'cores used'
 max_cpu ← SYLGet 'cores available'
 ncpu ← ncpu ⌊ max_cpu  ⍝ No more than available ...
 ⍝
 ⍝ Execute ...
 ⍝
 z←ncpu SYLSet 'cores used'
 start ← ¯5↑⎕ts
 ⍎what
 stop  ← ¯5↑⎕ts
 z←old_cpu SYLSet 'cores used'
 ⍝
 ⍝ Compute execution time
 ⍝
 →(stop[0]=start[0])/ok    ⍝ same day
   stop[0]←stop[0]+1       ⍝ day changed
 ok:
 start ← 32 24 60 60 1000 ⊥ start
 stop  ← 32 24 60 60 1000 ⊥ stop
 z←(⍕(stop-start)÷1000),' seconds at num core = ',(⍕ncpu),' of ', ⍕max_cpu



      T∆Time ← ⍳1000
      Time 'a←⍳1000000'
Time[4] SYLGet
Time[5] SYLSet
Time[9] →⍬
Time[10] 1
Time[12] 0
Time[13] 1
Time[14] 6
Time[15] 1
Time[19] 1
Time[20] 16 21 28 46 188
Segmentation fault (core dumped)








reply via email to

[Prev in Thread] Current Thread [Next in Thread]