Skip to content

Cythonize - #5

Open
VorontsovIE wants to merge 21 commits into
autosome-ru:masterfrom
VorontsovIE:cythonize
Open

Cythonize#5
VorontsovIE wants to merge 21 commits into
autosome-ru:masterfrom
VorontsovIE:cythonize

Conversation

@VorontsovIE

Copy link
Copy Markdown
Member

Optimization: LogML and square splitter are now written using cython in critical places. 4x times speed boost overall.

@VorontsovIE
VorontsovIE force-pushed the cythonize branch 2 times, most recently from 7aa4f2f to 3c3deaa Compare December 27, 2018 23:20
@Dronte

Dronte commented Jan 26, 2019

Copy link
Copy Markdown
Contributor

Этот надо поребейзить

…not to create a numpy array but to modify existing
…lty for dynamic typing here (in SquareSplitter cython code) shouldn't be very big

@Dronte Dronte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень круто. Небольшие проблемы со стилем, в остальном все ок.

if self.split_number_regularization_multiplier != 0:
number_regularization = self.split_number_regularization_function(num_splits[:prefix_end] + 1)
score_if_last_split_at[:prefix_end] -= self.split_number_regularization_multiplier * number_regularization
score_if_last_split_at[0] += self.split_number_regularization_multiplier * self.split_number_regularization_function(1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не сделать ли тут строчки покороче?

Comment thread setup.py
from Cython.Build import cythonize
from setuptools.extension import Extension

gcc_opts = ['-march=native', '-Ofast',]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-O2 ?
-flto ?
-funroll-loops ?

Comment thread test/test_pasio.py
assert optimal_score == 1

sequence = 'AAA'
sequence = seq2array('AAA')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще говоря, один из смыстов этих тестов был в том, что не важно, какую именно последовательность мы бъем, важно, как мы ее скорим.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Но я понимаю, что с cython этот номер не прокатит.

raise NotImplementedError()

cdef class LogMarginalLikelyhoodComputer(BasicLogMarginalLikelyhoodComputer):
def __init__(self, counts, alpha, beta, split_candidates, log_computer=None, log_gamma_computer=None, log_gamma_alpha_computer=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Длина строки

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants