问题
I am working on a Package, this package using BinDeps to pull in some C source code, and compile some binaries.
My julia module then mostly just exposes ccalls to those functions.
Now there are about 5 different options for how the C source can be compiled, with various different optimisations turned on.
And to go with them various other changes that are triggered by by a constant that is written to the deps.jl
that is output by BinDeps.
So I would like to import each of the different builds of my package as different modules, so I can benchmark them using BenchmarkTools.jl.
Currently, my plan is to make a script that generates 5 different versions of my module, by copying it, and changing it's name, and by using a different deps.jl
files to link to different compiled shared libraries.
And then (assuming I renamed them numerically):
using BenchmarkTools
import MyMod_1
import MyMod_2
import MyMod_3
import MyMod_4
import MyMod_5
@show @benchmark MyMod_1.foo()
@show @benchmark MyMod_2.foo()
@show @benchmark MyMod_3.foo()
@show @benchmark MyMod_4.foo()
@show @benchmark MyMod_5.foo()
Currently I am scripting the copying and renaming of modules. It is a little scary, and seems a bit brittle.
But is there a better way?
来源:https://stackoverflow.com/questions/39219804/importing-multiple-versions-of-the-same-module-package-for-benchmarking