Skip to content
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

Serialize ponters in Opt #12

Closed
papamarkou opened this issue Feb 25, 2014 · 2 comments
Closed

Serialize ponters in Opt #12

papamarkou opened this issue Feb 25, 2014 · 2 comments
Labels

Comments

@papamarkou
Copy link

@stevenj is it easy to write a serialize function for Opt type objects? I need it when I run some functions in parallel. See also this Julia issue:

JuliaLang/julia#5954 (comment)

@stevengj
Copy link
Collaborator

No, it is rather difficult to do in a completely general way, because Opt contains a pointer to a C struct that itself contains pointers to C structs as well as C function pointers.

It would be better to serialize the parameters you used to create the Opt object, and then just create a new one.

@papamarkou
Copy link
Author

Thanks @stevengj. I created a type called NLoptimizer holding some parameters that are passed to Opt and a convert function that maps NLoptimizer ojbects to Opt objects. This workaround allows me to use NLopt in parallel. If you think that this could be useful to other users too, I could open a pull request. Here is the code:

https://github.com/scidom/ChaosCommunications.jl/blob/master/src/optimizers/NLoptimizer.jl

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

No branches or pull requests

2 participants