# Partially blackbox optimization with JuMP?

**URL:** <https://discourse.julialang.org/t/partially-blackbox-optimization-with-jump/3335>\
**Category:** Optimization (Mathematical)\
**Tags:** cuda\
**Created:** [April 22, 2017, 8:17am UTC](https://discourse.julialang.org/t/partially-blackbox-optimization-with-jump/3335 "2017-04-22T08:17:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [April 22, 2017, 8:17am UTC](https://discourse.julialang.org/t/partially-blackbox-optimization-with-jump/3335/1 "2017-04-22T08:17:23Z")

</div>

I have a problem which I have been using NLopt to solve, but am interested in converting it into a JuMP model to try other solvers and also get some autodifferentiation. The problem is that the objective function is a black box which uses a CUDA kernal. However, I have a Julia function for the same calculation that could be autodifferentiated. Is it possible to register the Julia version, but solve using the CUDA version?

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [April 22, 2017, 12:23pm UTC](https://discourse.julialang.org/t/partially-blackbox-optimization-with-jump/3335/2 "2017-04-22T12:23:36Z")

</div>

I’m not sure I understand the question, but you’re free to register different methods to evaluate the function and the gradient. You could generate a method to evaluate the gradient by using ForwardDiff/ReverseDiff on your pure Julia function. It doesn’t sound like JuMP’s `autodiff=true` is appropriate here.
