File tree 2 files changed +34
-0
lines changed
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ all : fn_like.o
2
+
3
+ clean :
4
+ rm -f * .o * .ll
5
+
6
+ % .o : % .c
7
+ ../dockerscript.sh clang-12 /host/$^ -O3 -Xclang -load -Xclang /Enzyme/enzyme/build/Enzyme/ClangEnzyme-12.so -ffast-math -o /host/$@
8
+
9
+ run-% : % .o
10
+ ../dockerscript.sh /host/$^ 3.14
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <math.h>
3
+ #include <assert.h>
4
+
5
+
6
+ double __enzyme_autodiff (void * , ...);
7
+
8
+ double log1p_like_function (double a ) {
9
+ return 2 * a ;
10
+ }
11
+
12
+ double test (double a ) {
13
+ return log1p_like_function (a );
14
+ }
15
+
16
+ void * __enzyme_function_like [2 ] = {(void * )log1p_like_function , "log1p" };
17
+
18
+ int main (int argc , char * * argv ) {
19
+
20
+ double grad_out = __enzyme_autodiff (test , 2.0 );
21
+ printf ("Gradient of the log1p like function is %f" , grad_out );
22
+
23
+ return 0 ;
24
+ }
You can’t perform that action at this time.
0 commit comments