MilesCranmer commited on
Commit
a2f31d9
1 Parent(s): 7aaa5b1

Apply @fastmath and @simd to eval loops

Browse files
Files changed (1) hide show
  1. julia/sr.jl +6 -6
julia/sr.jl CHANGED
@@ -297,11 +297,11 @@ function evalTreeArray(tree::Node, cX::Array{Float32, 2})::Union{Array{Float32,
297
  return nothing
298
  end
299
  op = unaops[tree.op]
300
- @inbounds @simd for i=1:clen
301
  cumulator[i] = op(cumulator[i])
302
  end
303
- @inbounds for i=1:clen
304
- if isinf(cumulator[i])
305
  return nothing
306
  end
307
  end
@@ -317,11 +317,11 @@ function evalTreeArray(tree::Node, cX::Array{Float32, 2})::Union{Array{Float32,
317
  return nothing
318
  end
319
 
320
- @inbounds @simd for i=1:clen
321
  cumulator[i] = op(cumulator[i], array2[i])
322
  end
323
- @inbounds for i=1:clen
324
- if isinf(cumulator[i])
325
  return nothing
326
  end
327
  end
 
297
  return nothing
298
  end
299
  op = unaops[tree.op]
300
+ @fastmath @inbounds @simd for i=1:clen
301
  cumulator[i] = op(cumulator[i])
302
  end
303
+ @inbounds @simd for i=1:clen
304
+ if isinf(cumulator[i]) || isnan(cumulator[i])
305
  return nothing
306
  end
307
  end
 
317
  return nothing
318
  end
319
 
320
+ @fastmath @inbounds @simd for i=1:clen
321
  cumulator[i] = op(cumulator[i], array2[i])
322
  end
323
+ @inbounds @simd for i=1:clen
324
+ if isinf(cumulator[i]) || isnan(cumulator[i])
325
  return nothing
326
  end
327
  end