首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用和包含,或者至少包括更快的方法的并行性?

使用和包含,或者至少包括更快的方法的并行性?
EN

Stack Overflow用户
提问于 2022-05-06 09:37:42
回答 1查看 48关注 0票数 1

我开始有一个大项目,我目前正在使用并包含许多包和.jl文件:

代码语言:javascript
复制
a = time()
@info "Loading JuMP"
using JuMP
@info "Loading Gurobi"
using Gurobi
# @info "Loading Combinatorics, DelimitedFiles, Dates and StatsBase"
# using Combinatorics, DelimitedFiles, Dates, StatsBase
@info "Loading Combinatorics, DelimitedFiles, Dates and Random"
using Combinatorics, DelimitedFiles, Dates, Random
@info "Loading Distributions, Graphs, GraphsFlows[TODO] and Plots"
using Distributions
# using Graphs, GraphsFlows, GraphPlot, Plots
using Graphs, GraphPlot, Plots
@info "Loading Parameters and Formatting"
using Parameters, Formatting #https://stackoverflow.com/a/58022378/10094437
@info "Loading Compose, Cairo and Fontconfig"
using Cairo, Fontconfig, Compose
@info "Loading .jl files $(lpad("0%",4))"

include("write_tikz.jl")
include("with_kw_mutable_structures.jl")
include("instance.jl")
include("solution_checker.jl")
@info "Loading .jl files $(lpad("25%",4))"
include("create_subtour_constraint.jl")
# include("ilp_rho_rsp_st_chains.jl")
include("ilp_rho_rsp_without_uc.jl")
include("benders_rho_rsp.jl")
include("benders_subproblem_poly.jl")
@info "Loading .jl files $(lpad("50%",4))"
include("benders_subproblem_ilp_primal.jl")
include("benders_subproblem_ilp_dual.jl")
include("print.jl")
include("three_four_rho_rsp.jl")
@info "Loading .jl files $(lpad("75%",4))"
include("utilities.jl")
include("rho_rsp_lb.jl")
include("./plots/plots.jl")
include("local_searches.jl")
@info "Loading .jl files $(lpad("100%",4))"
@info time()-a

所有这些usingincludes每次发射朱莉娅都需要34秒钟。当已经编译和第二次执行include("main.jl")时,它确实更快,但是当已经编译一次时,仍然需要2s45。

我想知道是否有更快的方法来实现using包和includes朱莉娅文件,也许有并行性?

我用的是朱莉娅1.7.2

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-07 09:28:27

这些是需要考虑的步骤。

  1. 将您的所有代码封装到一个朱莉娅包中。朱莉娅软件包将在第一次使用时进行预编译,随后的时间将大大缩短。您不希望有一个包含这么多内容的代码--创建一个包来加快速度。
  2. 很可能在第(1)步之后就会很好了。然而,下一个选项是使用@jing提到的PackageCompiler.
  3. As将包编译成Julia映像,每个新的Julia版本都将在较短的时间内完成

的工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72139318

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档