Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Fix bug with @Noacc
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul H. Liu committed Oct 21, 2015
1 parent a97f53d commit 42bd161
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/OptFramework.jl
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,19 @@ function findOriginalFunc(mod::Module, name::Symbol)
end

function recursive_noacc(ast::Symbol)
findoriginalfunc(current_module(), ast)
if haskey(gOptFrameworkDict, GlobalRef(current_module(), ast))
findOriginalFunc(current_module(), ast)
else
ast
end
end

function recursive_noacc(ast::Expr)
start = 1
if is(ast.head, :(=))
start = 2
elseif is(ast.head, :call) && isa(ast.args[1], Symbol)
ast.args[1] = findOriginalFunc(current_module(), ast.args[1])
elseif is(ast.head, :call) && isa(ast.args[1], Symbol)
ast.args[1] = recursive_noacc(ast.args[1])
start = 2
end
for i = start:length(ast.args)
Expand All @@ -616,7 +620,6 @@ The macro @noacc can be used at call site to specifically run the non-accelerate
"""
macro noacc(ast)
ast = recursive_noacc(ast)
println(ast)
esc(ast)
end

Expand Down

0 comments on commit 42bd161

Please sign in to comment.