Replies: 19 comments 16 replies
-
Hi @bradbell, For me the readme currently says: Best, Vassil |
Beta Was this translation helpful? Give feedback.
-
My mistake. I have gotten some simple clad examples to run on fedora38. My next question is how to store a clad gradient object in a class member variable ? The gradient object is create (in the examples) using statements of the form:
The problem is, if I want f_dx to be a member variable (so it does not need to be created each time), I need to declare the type of f_dx before the assignment (and I do not know it). Using typeid(f_dx).name() I get something like this:
which is not helpful. |
Beta Was this translation helpful? Give feedback.
-
I am trying to include clad in the following project: The only real work to do this is the create a class, derived from cmpad::gradient, that computes the gradient using clad; see Here is an example of what that looks like for adolc: During the setup function, I want the clad version of the gradient to store an object in the derived class member variable. That way I can separate the setup cost from the evaluation cost. The problem is I do not know to declare the variable that will hold the the clad gradient ? |
Beta Was this translation helpful? Give feedback.
-
@vaithak The project cmpad is under construction and hence is not yet up to my standards for documentation. I think it would be easier to just answer my question above. In case that you would like to try to implement |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response. I suspect this means that clads rates (speeds) will not be much different if one includes the setup time or not. For cppad_jit and cppadcg, the source code for the derivatives is computed at run time and then compiled and linked in, This brings up an issue. Does clad include all of the if-then branching in the function, so one does not have to re-compile for different argument values ? |
Beta Was this translation helpful? Give feedback.
-
My next issue is using a function object inside of the function that is being differentiated; Here is my example that fails / runs when I use (do not use) a function object:
|
Beta Was this translation helpful? Give feedback.
-
That should work, can you open an issue with a minimal reproducing example? |
Beta Was this translation helpful? Give feedback.
-
I am still having trouble using function objects. Here is my next example that demonstrates the problem:
|
Beta Was this translation helpful? Give feedback.
-
So that you understand the context of my difficulty, I have pushed a clad branch with my current attempt at creating a gradient for cmpad. Here is the source code: |
Beta Was this translation helpful? Give feedback.
-
I can confirm that the example in issue #625 now runs on my Fedora 38 system using the following commands:
Unfortunately, when I try to compile the code (CASE 3) above I get the following:
|
Beta Was this translation helpful? Give feedback.
-
I created the example below (which uses the default constructor for the function objects) and seems to have the same problem.
|
Beta Was this translation helpful? Give feedback.
-
I am having trouble figuring out how to use cmake to build a simple project that uses clad. The test_clad.sh test script below tires to do this. When I run it, I get the message:
test_clad.sh
|
Beta Was this translation helpful? Give feedback.
-
Would that help you clad/cmake/modules/AddCladBenchmark.cmake Line 20 in bba8a47 Here we attach the plugin to the invocation. |
Beta Was this translation helpful? Give feedback.
-
So how would I modify my CMakeLists.txt file in the example above; i.e.,
where $clad_so gets replaced by the location of the clad.so file ? @vgvassilev
|
Beta Was this translation helpful? Give feedback.
-
It it does not work. When I execute the script, the build with
works but using cmake and make does not. The final output is:
|
Beta Was this translation helpful? Give feedback.
-
The solution to this problem is above; see |
Beta Was this translation helpful? Give feedback.
-
I have another case that is giving an unexpected compile error. To be specific:
Note that the first line in example.cpp is:
If you change
|
Beta Was this translation helpful? Give feedback.
-
My goal in cmpad is to have a single set of source code for algorithms that can be differentiated by many packages and to compare the speed of those algorithms. I also want cmpad to provide an example implementation of derivative calculations for many packages. I want to make it as easy as possible to add a package and to make it possible to test any subset of packages. For example, if a clad developer wanted to improve the speed of the clad implementation, she or he would only need to attach clad to cmpad to work on that (not worry about the other packages). I could have made the interface use raw C vectors together with a size argument, but I did not do this because indexing off the end of the vector is a very common problem. CppAD::vector acts very much like std::vector and checks for indexing off the end of the vector. So I decided to use cmpad::vector as either CppAD::vector or std::vector, when one chooses CppAD::vector (and NDEBUG is defined) it checks for indexing errors. I think what is needed on the clad side is better documentation of what operations can be differentiated. This would expand with time as more and more operations are handled. I suspect that this is determined by what LLVM operations are currently handled by clad ? If so, I would embed that documentation in the source code that handles the operations . |
Beta Was this translation helpful? Give feedback.
-
It has been a while so I thought I would check and see if clad really supports function objects, demos/Functor seems to indicate that it does.
|
Beta Was this translation helpful? Give feedback.
-
I am trying to install clad on fedora38.
The current version of clang++ on fedora38 is 16.0.6, but the install instructions
https://github.com/vgvassilev/clad#how-to-install
say that version 16.0x is not supported. Does this mean I cannot use clad ?
Beta Was this translation helpful? Give feedback.
All reactions