S4TF speed #630
Comments
What compilation flags did you pass to |
@dan-zheng, how can I pass this option to the Xcode? I'm not using terminal because of this issue (but that's a different story)
|
I forget, but you can Google "Xcode pass Swift compiler flags". The Workaround: manually add an RPATH to SwiftPM binaries. VERSION=swift-tensorflow-DEVELOPMENT-2019-12-23-a
sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/$VERSION.xctoolchain/usr/bin/swift-build
sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/$VERSION.xctoolchain/usr/bin/swift-package
sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/$VERSION.xctoolchain/usr/bin/swift-run
sudo install_name_tool -add_rpath "@executable_path/../lib/swift/macosx" /Library/Developer/Toolchains/$VERSION.xctoolchain/usr/bin/swift-test |
I did that :), I found posts for old Xcode, but new one has different interface.
Thanks for the tip. Now it works, and bench time didn't change much with → swift run -c release -Xswiftc -Ounchecked Kalman
Start execution
Finished execution
Elapsed time: 9.111591231019702 |
Hi, Just a note here. |
@pschuh, thanks a lot! It does make sense. Does it mean that S4TF behaves like TensorFlow 2.0 in Python without applying
Is there a |
@dan-zheng, @pschuh Not related to this thread, but the situation with Swift as differentiable programming language reminds me of the essay "Too much calculus" by Gilbert Strang. I do want to do research using Swift because I like swift-python compatibility, language styling and its direction of development (mainly set by Google), but the necessary and the lacking bit is efficient linear algebra operations. I thought that TensorFlow integrates into Swift smoothly without any additional cost. If that's fixable then great, if not, then swift needs support for matrix (tensor) operations from BLAS, LAPACK (Apple's Accelerate). This is vital for all types of research, it is not enough to say that swift supports auto-differentiation out-of-the-box (although, this is a very cool thing). |
Thanks for your feedback! Please create a new issue next time. 🙂 I guess everyone has different needs and priorities: you may be super interested in differentiable linear algebra operations, but our team is working on things important to us, like:
Our team is trying to tackle issues that are important for our use cases (deep learning models). Regarding open-source work, we try to focus on fundamental issues that only we have the resources to solve. Other issues, like adding and improving APIs, are perfect for the open-source community to contribute to. I don't think we currently have the motivation or bandwidth for a team member to work on tensorflow/swift-apis full-time (e.g. to add linear algebra operations, backed by BLAS/LAPACK), but that may change in the future. I think a productive way for community members like you to contribute is "adding the APIs that you want to use". You've been doing a great job of kickstarting and driving the "linear algebra operations" effort, in TF-980 and #562: if it weren't for you, we probably wouldn't have any linear algebra APIs right now, since it's not a priority for our team. This is a great example of how open-source contributors like you can influence an open-source project. Perhaps tensorflow/swift-apis in its current state isn't ideal for you due to more fundamental issues, like poor performance or the lack of multiple backend support (e.g. supporting BLAS/LAPACK as a
Since differentiable programming is designed as a general Swift language feature, it's totally possible to extend an existing library like https://github.com/AlexanderTar/LASwift and make linear algebra operations differentiable (using However, for the most impact, and to unify the community's efforts, I would recommend finding ways to contribute to tensorflow/swift-apis. Related mailing list discussion. apple/swift-numerics is another Swift ecosystem project that plans to add support for |
Ok, I will make a separate post in the S4TF mailing list.
The TensorFlow provides lots of functions from LAPACK and BLAS, and it also has a GPU backend with CUBLAS support. This unification of computational backends makes TensorFlow a nice choice. The best solution for me would be to generate TensorFlow swift bindings so that S4TF could call C++ kernel implementations directly without any extra cost.
Thanks! :) |
Hello everyone,
I'm benchmarking Kalman Filter on S4TF, and here are results:
The question is why is that soo slow, am I doing something wrong?
Swift code (Release, Development toolchain 2019-12-23):
Python TensorFlow (version 2.1, pip installed, no GPU, python 3.6)
Matlab
The text was updated successfully, but these errors were encountered: