-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added timings report if -ftime-report flag is enabled, fixes issue #769
Clad will now print a timings report for all clad function calls Adds CladTimerGroup class to time the clad functions Repurposes LIBCLAD_TIMING flag to print only the timings report for clad
- Loading branch information
1 parent
97e4092
commit 8d6d03b
Showing
3 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// RUN: %cladclang %s -I%S/../../include -oTimingsReport.out -ftime-report 2>&1 | FileCheck %s | ||
|
||
#include "clad/Differentiator/Differentiator.h" | ||
// CHECK-NOT: {{.*error|warning|note:.*}} | ||
// CHECK: Timers for Clad Funcs | ||
|
||
double nested1(double c){ | ||
return c*3*c; | ||
} | ||
|
||
double nested2(double z){ | ||
return 4*z*z; | ||
} | ||
|
||
double test1(double x, double y) { | ||
return 2*y*nested1(y) * 3 * x * nested1(x); | ||
} | ||
|
||
double test2(double a, double b) { | ||
return 3*a*a + b * nested2(a) + a * b; | ||
} | ||
|
||
int main() { | ||
auto d_fn_1 = clad::differentiate(test1, "x"); | ||
double dp = -1, dq = -1; | ||
auto f_grad = clad::gradient(test2); | ||
f_grad.execute(3, 4, &dp, &dq); | ||
printf("Result is = %f\n", d_fn_1.execute(3,4)); | ||
printf("Result is = %f %f\n", dp, dq); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters