# Configuration

The `Configuration` type provides the ability to customize how edge models are created and executed on the local device.

## Creating the Model Configuration

```csharp
/// <summary>
/// Create a configuration
/// </summary>
Configuration ();
```

The `Configuration` defines a trivial constructor.

## Specifying the Compute Target

```csharp
/// <summary>
/// Specify the compute target used for model predictions.
/// </summary>
ComputeTarget computeTarget { get; set; }
```

The `computeTarget` is used to specify the compute target that will be used to accelerate model predictions:

### Compute Target

```csharp
/// <summary>
/// Compute target used for model predictions.
/// </summary>
enum ComputeTarget : int {
    /// <summary>
    /// Use the default compute target for the given platform.
    /// </summary>
    Default = 0,
    /// <summary>
    /// Use the CPU.
    /// </summary>
    CPU     = 1 << 0,
    /// <summary>
    /// Use the GPU.
    /// </summary>
    GPU     = 1 << 1,
    /// <summary>
    /// Use the neural processing unit.
    /// </summary>
    NPU     = 1 << 2,
    /// <summary>
    /// Use all available compute targets including the CPU, GPU, and neural processing units.
    /// </summary>
    All     = CPU | GPU | NPU,
}
```

{% hint style="info" %}
The `ComputeTarget` enumeration is defined in the [`MLEdgeModel`](/unity/api/mlmodel/mledgemodel.md) class.
{% endhint %}

## Specifying the Compute Device

```csharp
/// <summary>
/// Specify the compute device used for model predictions.
/// The native type of this pointer is platform-specific.
/// </summary>
IntPtr computeDevice { get; set; }
```

On systems with multiple GPU's, the model data allows for specifying the preferred compute device for accelerating model predictions.

{% hint style="info" %}
Set this field to `IntPtr.Zero` to use the default compute device.
{% endhint %}

{% hint style="success" %}
The `computeDevice` is exposed as an opaque pointer to a platform-specific type:

* On iOS and macOS, this pointer is an [`id<MTLDevice>`](https://developer.apple.com/documentation/metal/mtldevice?language=objc).
* On Windows, this pointer is an [`ID3D12Device`](https://docs.microsoft.com/en-us/windows/win32/api/d3d12/nn-d3d12-id3d12device).
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.natml.ai/unity/api/mlmodel/mledgemodel/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
