-
Notifications
You must be signed in to change notification settings - Fork 27
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
default_obj_ of Device and Graph should be instantiated in one place. #211
base: develop
Are you sure you want to change the base?
Conversation
Ah, this can be more easily to do. Will fix |
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
c7843c1
to
f3dfd3b
Compare
@vbkaisetsu Please check if this change is consistent with #47 discussion. |
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.
LGTM.
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.
mixins_test fails.
I think PRIMITIV_BUILD_LIBRARY
should be enabled in mixins_test.
Thanks. Will look into it in later. |
All tests passed on Windows. |
This seems the change introduces another environment dependent behavior. I guessed we need to use some predefined macros by the Windows compilers (e.g., |
Make sense. Do you need some comments? |
It would be fine to put a link to this issue (and some short comments). |
ee6af58
to
0776ade
Compare
0776ade
to
6e29c77
Compare
Current implementation of primitiv defines
default_obj_
in header file device.h/graph.h.This works almost cases. But when building DLL&EXE on Windows,
default_obj_
is instantiated in two places.`default_obj_` in the DLL is set via set_default but `default_obj_` in the executable always NOT be updated. So the Windows application using primitiv always crash when constructor of Parameter/Input/Node is called. To fix this issue, an instantiation of `default_obj_` should be at a place. This change remove the definitions of `default_obj_`. And `Device::default_obj_` and `Graph::default_obj_` are instantiated via definition of dummy function. These instances are embedded in DLL, and code of application do not need to use any hacks(ex: define PRIMITIV_MAKE_INSTANCE in main.cc) to instantiate them.I confirmed this works on Windows & Linux. Thanks.