-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Implement device abstraction for remaining classes #587
Implement device abstraction for remaining classes #587
Conversation
@shelhamer @jeffdonahue @sergeyk @longjon @kloudkl, etc. I'd like to get your input on the direction I've taken with c489e3e8c77a92f2374a00b568bcf1fe438db292 (mostly in the new file GetDevice()->axpy(...); // axpy on the device corresponding to the current mode or, to specifically use the cpu or gpu version: GetDevice(Caffe::CPU)->axpy(...);
GetDevice(Caffe::GPU)->axpy(...); The end goal here would be to have all the cpu functions in I think the thing that's a bit tricky here is how to deal with layers that have layer-specific gpu kernels. Right now, you're using Let me know if you think that's a useful way to continue here. If it is, I'll move forward with a similar consolidation of all the gpu functions in |
Oh, I'll also work on rebasing on |
Hey @robwhess, this looks great to me, but doesn't compile for me @ c489e3e (maybe I shouldn't I be able to?). I get these errors (using Ubuntu with gcc 4.6.3):
It does compile @ the previous commit: 92b98f7 |
@robwhess, thanks for the refactoring efforts! To keep backward compatibility, the original math functions were not directly moved into the device classes in #415. This is a very important design decision considering that there are hundreds of users that have forked, git cloned or downloaded the code and developed their own algorithms or applications. Some of them must have explicitly used the math functions which can't be removed without breaking their codes. |
@jeffdonahue, woops, I completely forgot to run @kloudkl is this a major concern? This is still a very young software package. I feel like at this point in the project's life, it'd be best to let the interface evolve into what it should be (and it's still an open question as to whether this particular change is what Caffe should be) rather than worrying a lot about backwards compatibility. I think that's especially true in this case because the resolution of this change would be a simple find-and-replace operation. I suspect there have already been tougher changes to integrate back into peoples' forks than this one. If folks find this change worthwhile but believe backwards incompatibility is a real problem here, maybe as an intermediate step we can keep the actual implementation of the device-specific functionality in the My personal preference is to skip deprecation and get rid of the |
I'm inclined to agree with all of @robwhess's remarks in regards to backwards compatibility. I think we should make a reasonable effort to maintain backwards compatibility for very public interfaces like prototxts, etc., but I'm less inclined to worry about people who have implemented their own layers in their private branches having their rebases be effortless. Especially in the case of a change like this where a bit of effort in the short term makes your life easier in the long run. In lieu of the level of deprecation this PR proposes, @robwhess 's proposal to replace the implementations to the existing |
I'm down with @robwhess's and @jeffdonahue's assessment. On with the new Le mardi 8 juillet 2014, Jeff Donahue [email protected] a écrit :
|
I mistakenly applied some of the large scale software engineering principles and should stop worrying too much about the backward compatibility. |
I don't want to discourage you from raising such issues in the future -- all other things being equal it's of course better to keep all public facing methods backwards compatible rather than arbitrarily breaking them all the time. We just have to weigh the drawbacks of breaking a particular interface (other devs have to put in some amount of extra effort if they want to use their unofficial extensions with the latest version of Caffe) against the benefits (maintaining backward compatibility creates an additional burden for future development; breaking it in this case encourages other devs to learn how the new interface works, in turn speeding up their future development). For me personally I have quite a bit of non-public Caffe-extending code that this will break, and yet I'm almost excited to rebase that code once this is integrated due to the massive simplification that will result. In generally we might prioritize backwards compatibility lower than some open source projects because none of us (the core Caffe devs/maintainers at Berkeley) are able to focus on software engineering issues associated with Caffe as a full time job; rather we are all using it mainly to accomplish research objectives. I'd guess (or hope) that as the project matures we'll converge closer and closer to having "ideal" interfaces and begin to see far fewer of these major breaking changes that touch huge parts of the codebase, at which point maintaining backwards compatibility will likely create less maintenance burden and therefore potentially become a higher priority. |
Note that this PR's history is now somewhat messy because I rebased on @shelhamer, @jeffdonahue, would it make sense to just close out this PR and start a new one directly into |
The workflow is you rebase on dev at your fork then we force push the Make sense? I commented somewhere with the details earlier. Sorry I can't find it out. Le mercredi 23 juillet 2014, Rob Hess [email protected] a écrit :
|
@shelhamer Oh, right, in #610: #610 (comment). That's where we'll have a clean history into |
@shelhamer @jeffdonahue the rebase on As an aside, are we wedded to using Case in point: I spent 3 days sussing out this rebase, and when I finished and went back and checked the diff with Is it worth the significant extra work of a rebase to maintain what seems to me like a marginally cleaner commit history? I'd argue that a few extra merge entries in the history is very much worth the time and effort saved by just using |
I'm for rebase in small and medium impact PR and for merge for large PR that often become feature branches in Caffe pipeline. See also some pro and cons here |
@robwhess I definitely sympathize with your comments on rebase -- I don't know if I've ever spent 3 days on one, but certainly several hours and probably a day. Personally my feeling is that the cleaner linear history is worth a bit of effort, but almost certainly not worth the amount you had to put in. I wouldn't mind having a couple merge commits in a PR this size if it makes your life that much easier, but @shelhamer is our resident git expert and I'm not sure he would agree. There are a couple things you can do to make your life substantially easier when rebasing. One is to "squash" your history into a smaller number of commits (reordering related commits to combine together, when necessary), so that you're not repeatedly resolving what's essentially the same conflict. This is pretty easy to do with git interactive rebase ( Another thing you can do starting now is use [1] http://git-scm.com/book/en/Git-Tools-Rewriting-History |
(and thanks for all the laborious work! force pushed to BVLC device-abstraction.) |
Thanks @jeffdonahue. I'll read those references. I think there were two main issues with this rebase: it'd been quite a while since the last rebase, so |
@robwhess thanks for all of your effort and the involved rebase! As the local git fanatic and survivor of many rebases myself, let me explain our policy and give a little advice:
As @jeffdonahue suggested and you concluded, the best course is to closely track development and routinely rebase. Granted the current pace of Caffe hacking can make this interesting, and sometimes changes like my #555 come along that throw a further wrench into it. Thanks for pushing through it. That said, rebases can be painful when there is divergence or several branches are integrated all at once. See #167 for my personal favorite. If a particularly mind-bending rebase comes up again, we can discuss the best way to resolve it. |
There are more classes left to abstract to continue the work started by @kloudkl in #415. Here's a PR in which to do that work. I'll note when the PR is ready for review/merge.
I'm not sure if there will be more PRs into this branch after this, but we can take that as it comes.