直线仿形Cython 0.25

2024-10-01 19:31:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在写一些赛顿的个人资料。但我不能让它工作。在

我已经试着遵循How to profile cython functions line-by-line中给出的所有步骤

但我没有得到任何时间的结果。我所做的事情张贴在这里:

我使用的是python3.6和cython0.25.2

我要做的是:

首先我运行:

python setup.py build_ext --inplace

在设置.py我补充道:

^{pr2}$

我加了一个分机

define_macros=[('CYTHON_TRACE', '1')]

在剧本里runMIcython.pyx版,我添加了:

@cython.profile(True)
@cython.linetrace(True)
@cython.binding(True)

在ipython shell中,我尝试运行(大约需要1分钟):

%load_ext line_profiler
import line_profiler 
import runMolecularIntegrals  
profile = line_profiler.LineProfiler(runMolecularIntegrals.runCythonIntegrals)
profile.runcall(runMolecularIntegrals.runIntegrals) 
profile.print_stats()

但我得到的结果是:

Line #      Hits         Time  Per Hit   % Time  Line Contents  
==============================================================  
    10                                           cpdef 
runCythonIntegrals(int [:,:] basisidx, double [:,:] basisfloat, int [:,:] basisint, double[:,:] input, double[:,:] Na, double[:,:] S, double[:,:] T, double[:,:,:,:] ERI):

Tags: pyimporttruetimelineprofileextprofiler

热门问题