模块不支持预编译,但是由具有以下功能的模块导入

时间:2019-03-29 04:03:32

标签: julia

我正在使用Julia中的pmap和Distributed arrays来并行化代码。运行命令@everywhere include("./code.jl")时,将输出一长串警告消息,并且在此过程中会花费大量时间。文件code.jl中的程序包例如:

using DataFrames
using Images

我不确定如何解决missing from the cache

的问题

这是正在运行的行

@everywhere include("./code.jl")

我没想到会有一连串的投诉。但是,所有工人的输出都与此类似:

From worker 2:  │ This may mean CategoricalArrays [324d7699-5711-5eae-9e2f-1d82baa6b597] does not support precompilation but is imported by a module that does.
      From worker 2:    └ @ Base loading.jl:947
      From worker 6:    ┌ Warning: Module CategoricalArrays with build ID 5344443537363826 is missing from the cache.
From worker 4:  ┌ Warning: Module DataFrames with build ID 5344463834994296 is missing from the cache.
      From worker 4:    │ This may mean DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0] does not support precompilation but is imported by a module that does.
      From worker 4:    └ @ Base loading.jl:947
      From worker 2:    ┌ Warning: Module DataFrames with build ID 5344464953933087 is missing from the cache.
      From worker 2:    │ This may mean DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0] does not support precompilation but is imported by a module that does.

2 个答案:

答案 0 :(得分:1)

您可能有一个需要重新编译的程序包,并且您遇到了一种竞争状况,所有工作人员都认为他们需要独立地重新编译它。尝试启动一个julia会话并键入]precompile]进入pkg模式)。一旦完成,为了安全起见,您可以尝试using DataFrames来确保它起作用。然后在上面尝试您的代码。

答案 1 :(得分:1)

@tholy的答案是正确的-您将需要记住,每次更新软件包时都要重新编译。

应对竞争状况的另一种方法是在本地导入软件包,而不是在分布式版本中导入

'''
    class Post(models.Model):
        title = models.CharField(max_length=120)
        description = models.CharField(max_length=250)
        author = models.ForeignKey(settings.AUTH_USER_MODEL,default=1, 
        on_delete=models.CASCADE)
'''

假设您的文件仅导入包并定义了功能,则可以尝试:

using DataFrames
@everywhere using DataFrames

这应该会有所帮助,更新应用程序使用的某些软件包时,您无需记住要重新编译。