使用STAMPEDE在yt项目中运行python程序

时间:2016-02-06 07:11:05

标签: python yt-project

我一直在研究这个python程序来查找我的文件的max_dens,但每当我执行该文件时,我都会得到同样的错误。谁能告诉我这些错误是指什么?我正在使用yt 3.1

  

计算并绘制随时间变化的最大密度

    import yt
    #import LibCartesian3D
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    import glob
    import numpy as np
    flashFolder = '/work/03858/thaque56/run_149/'
    basename = 'super3d_' # sets the prefix of the plotfiles and checkpoint files. Usually 'super3d_' for MHD, 'relax_' for purehydro.
    useAllPlotfiles = False # set True to use glob.glob to select plotfiles (by default uses all available files)
    endcount = 5  # specify if useAllPlotfiles == False, gives the number of the last plotfile which is used

    # ============================ constructs list of filenames if script is run on its own, otherwise supplied by allPlots.py !
    def getfilenames(useAllPlotfiles,endcount):
            if useAllPlotfiles == True:
                    plotFilenames_own = glob.glob(flashFolder + basename + 'hdf5_plt_cnt_[0-9][0-9][0-9][0-9]')
                    plotFilenames_own.sort()
            else:
                    plotFilenames_own = []
                    for n in range(0,endcount + 1):
                            filename = flashFolder + basename + 'hdf5_plt_cnt_%04d' % n
                            plotFilenames_own.append(filename)
            return plotFilenames_own

    #============================

    def main(filenames):
            print 'Executing maxDens.py'

            max_dens = np.zeros(len(filenames))
            time = np.zeros(len(filenames))

            for n in range (len(filenames)):
                    pf =yt.load(filenames[n])
                    time[n] = pf.current_time
                    dens_max, dens_max_location = pf.h.find_max('dens')
                    max_dens[n] = dens_max

            print time, max_dens
            plt.plot(time,max_dens)
            plt.xlabel('time [s]')
            plt.ylabel('density [g/cm^3]')
            plt.title('Maximum Density over Time')
            plt.savefig('MaxDens.png')


    if __name__ == "__main__":
            plotFilenames_own = getfilenames(useAllPlotfiles,endcount)
            main(plotFilenames_own)

为了方便起见,我也附上了错误。

>     TACC: Starting up job 6517689
>     TACC: Setting up parallel environment for MVAPICH2+mpispawn.
>     TACC: Starting parallel tasks...
>     Traceback (most recent call last):
>       File "maxDens.py", line 3, in <module>
>         import yt
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/__init__.py",
> line 121, in <module>
>         from yt.data_objects.api import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/data_objects/api.py",
> line 51, in <module>
>         from . import construction_data_containers as __cdc
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/data_objects/construction_data_containers.py",
> line 52, in <module>
>         from yt.frontends.stream.api import load_uniform_grid
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/frontends/stream/api.py",
> line 16, in <module>
>         from .data_structures import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/frontends/stream/data_structures.py",
> line 38, in <module>
>         from yt.geometry.grid_geometry_handler import \
>       File "/work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/yt/geometry/grid_geometry_handler.py",
> line 38, in <module>
>         from .grid_container import \
>       File "yt/geometry/selection_routines.pxd", line 34, in init yt.geometry.grid_container (yt/geometry/grid_container.c:9108)
>     ValueError: yt.geometry.selection_routines.SelectorObject has the wrong size, try recompiling
>     [c557-601.stampede.tacc.utexas.edu:mpispawn_0][child_handler] MPI
     

进程(排名:0,pid:130364)退出状态1

     
TACC: MPI job exited with code: 1

TACC: Shutdown complete. Exiting.
  

请帮我解决这个问题。我认为yt版本存在一些问题。

1 个答案:

答案 0 :(得分:0)

问题是需要重新编译使用cython生成的一些C扩展名。事实证明clean.sh脚本不会删除它们,所以你必须像这样清除它们:

$ cd /work/03858/thaque56/sw/yt-3.1/yt-x86_64/src/yt-hg/
$ hg --config extensions.purge= purge --all yt
$ python setup.py develop

很抱歉昨晚在yt邮件列表上给你错误的建议!希望这能为你解决问题。