-
Notifications
You must be signed in to change notification settings - Fork 97
Add JIT for crc, build into existing buffer to avoid copies [ESD-1108] #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2157a03 to
eb21ef4
Compare
|
Three questions:
|
|
Wait I see you already setup into_buffer as part of the framer here: https://github.com/swift-nav/libsbp/pull/658/files#diff-f7e7ceb9c48458bb44be66283049a27bR162 so you can ignore my question about whether the python drivers use these features yet. |
|
@denniszollo I think the bench scripts should be run regularly, but I don't think it should be part of CI-- maybe we can set these up in the Travis "cron" to run weekly or so. |
|
@denniszollo Benchmarking obs would be good for the next task I have planned, which is to add an "into_buffer" variant for the receive path. |
5c16df1 to
1202479
Compare
045c9d0 to
05663fe
Compare
|
Failed to build numba llvmlite
Installing collected packages: construct, futures, six, httpretty, pyserial, pyusb, pyftdi, pylibftdi, chardet, urllib3, idna, certifi, requests, requests-futures, numpy, llvmlite, numba, py, pytest, coverage, pytest-cov, cov-core, virtualenv, toml, pluggy, filelock, tox, ruamel.yaml
Running setup.py install for llvmlite: started
Running setup.py install for llvmlite: finished with status 'error'
Complete output from command /mnt/users/pasi/swiftnav/libsbp/python/.tox/py35/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-sp_tmt65/llvmlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-qxxtn93f/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/users/pasi/swiftnav/libsbp/python/.tox/py35/include/site/python3.5/llvmlite:
running install
running build
got version from file /tmp/pip-install-sp_tmt65/llvmlite/llvmlite/_version.py {'version': '0.27.1', 'full': 'f008359c1f9ee5e8a6a98f2095ea460f09f57edb'}
running build_ext
/mnt/users/pasi/swiftnav/libsbp/python/.tox/py35/bin/python3.5 /tmp/pip-install-sp_tmt65/llvmlite/ffi/build.py
LLVM version... make[1]: Entering directory '/tmp/pip-install-sp_tmt65/llvmlite/ffi'
# static-libstdc++ avoids runtime dependencies on a
# particular libstdc++ version.
g++ -shared -I/usr/lib/llvm-7/include -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -g -flto assembly.cpp bitcode.cpp core.cpp initfini.cpp module.cpp value.cpp executionengine.cpp transforms.cpp passmanagers.cpp targets.cpp dylib.cpp linker.cpp object_file.cpp -o libllvmlite.so -L/usr/lib/llvm-7/lib -flto -Wl,--exclude-libs=ALL -lLLVM-7
transforms.cpp:10:32: warning: ‘unwrap’ violates the C++ One Definition Rule [-Wodr]
inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) {
^
executionengine.cpp:53:27: note: return value type mismatch
inline TargetMachine *unwrap(LLVMTargetMachineRef P) {
^
/usr/lib/llvm-7/include/llvm/Target/TargetMachine.h:59:7: note: type name ‘llvm::TargetMachine’ should match type name ‘llvm::PassManagerBuilder’
class TargetMachine {
^
/usr/lib/llvm-7/include/llvm/Transforms/IPO/PassManagerBuilder.h:59:7: note: the incompatible type is defined here
class PassManagerBuilder {
^
executionengine.cpp:53:27: note: ‘unwrap’ was previously declared here
inline TargetMachine *unwrap(LLVMTargetMachineRef P) {
^
executionengine.cpp:53:27: note: code may be misoptimized unless -fno-strict-aliasing is used
/usr/bin/x86_64-linux-gnu-ld: /tmp/ccqf68sU.ltrans0.ltrans.o: relocation R_X86_64_32S against `_ZN4llvm3sys14DynamicLibrary7InvalidE' can not be used when making a shared object; recompile with -fPIC
/tmp/ccqf68sU.ltrans0.ltrans.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile.linux:20: recipe for target 'libllvmlite.so' failed
make[1]: *** [libllvmlite.so] Error 1
make[1]: Leaving directory '/tmp/pip-install-sp_tmt65/llvmlite/ffi'
7.0.1
SVML not detected
Traceback (most recent call last):
File "/tmp/pip-install-sp_tmt65/llvmlite/ffi/build.py", line 167, in <module>
main()
File "/tmp/pip-install-sp_tmt65/llvmlite/ffi/build.py", line 157, in main
main_posix('linux', '.so')
File "/tmp/pip-install-sp_tmt65/llvmlite/ffi/build.py", line 149, in main_posix
subprocess.check_call(['make', '-f', makefile])
File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-f', 'Makefile.linux']' returned non-zero exit status 2
error: command '/mnt/users/pasi/swiftnav/libsbp/python/.tox/py35/bin/python3.5' failed with exit status 1Google finding https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912790 |
|
@silverjam I haven't had a chance to review/test, but would it be difficult to encapsulate |
|
@benjaminaltieri @pmiettinen Fixed Ubuntu 16.04 by pinning the |
|
The |
denniszollo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additional python dependencies don't worry me too much, that is the python way. I'm all for any performance improvements in the client libraries and think this makes sense.
benjaminaltieri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IGTM!
+ If we're using libs that don't have a binary wheel available, we need Python dev packages to be able to build any C extensions from source. + Add numba and numpy to enable 'into_buffer' support
+ Use Numba JIT to speed up the crc routine in sbp.msg + Add 'into_buffer' support for sbp.msg so we can pack an SBP message into an existing buffer at the specified offset.
This change allows us to re-use one buffer for serializing a group of SBP messages and thus avoid unnecessary copies.
Make a helper function to reduce the scope of the try/catch that attempts to coerce a value to an iterator.
3d97ab0 to
01d354a
Compare
Design notes
Two general SBP parsing improvements:
Testing
Todo