Skip to content

Examples do not compile #71

Closed
Closed
@OwenTrokeBillard

Description

@OwenTrokeBillard

The examples do not compile.

I followed the build instructions for Linux and attempted to run one of the examples: cargo +enzyme run --example rosenbrock_fwd_iter. There are four compilation errors:

error: cannot find attribute `dup` in this scope
 --> examples/rosenbrock_fwd_iter.rs:4:17
  |
4 | fn rosenbrock(#[dup] x: &[f64; 2]) -> f64 {
  |                 ^^^
error[E0659]: `autodiff` is ambiguous
 --> examples/rosenbrock_fwd_iter.rs:3:3
  |
3 | #[autodiff(d_rosenbrock, Forward, DuplicatedNoNeed)]
  |   ^^^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `autodiff` could refer to a built-in attribute
note: `autodiff` could also refer to the attribute macro imported here
 --> examples/rosenbrock_fwd_iter.rs:1:5
  |
1 | use autodiff::autodiff;
  |     ^^^^^^^^^^^^^^^^^^
  = help: use `crate::autodiff` to refer to this attribute macro unambiguously
error[E0425]: cannot find function `d_rosenbrock` in this scope
  --> examples/rosenbrock_fwd_iter.rs:18:17
   |
4  | fn rosenbrock(#[dup] x: &[f64; 2]) -> f64 {
   | ----------------------------------------- similarly named function `rosenbrock` defined here
...
18 |     let df_dx = d_rosenbrock(&x, &[1.0, 0.0]);
   |                 ^^^^^^^^^^^^ help: a function with a similar name exists: `rosenbrock`
error[E0425]: cannot find function `d_rosenbrock` in this scope
  --> examples/rosenbrock_fwd_iter.rs:19:17
   |
4  | fn rosenbrock(#[dup] x: &[f64; 2]) -> f64 {
   | ----------------------------------------- similarly named function `rosenbrock` defined here
...
19 |     let df_dy = d_rosenbrock(&x, &[0.0, 1.0]);
   |                 ^^^^^^^^^^^^ help: a function with a similar name exists: `rosenbrock`

The second error states there are two definitions of the autodiff attribute:

  • One builtin, since the toolchain was built with Enzyme.
  • One in the current project, since the autodiff attribute is also defined in /src/lib.rs.

Two competing definitions of the attribute suggests a configuration issue. Am I missing a step?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions