예제 #1
0
 /// <summary>
 /// Enables a CPU device of the given kind.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <param name="kind">The CPU device kind.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder CPU(
     this Context.Builder builder,
     CPUDeviceKind kind)
 {
     builder.DeviceRegistry.Register(CPUDevice.GetDevice(kind));
     return(builder);
 }
예제 #2
0
 /// <summary>
 /// Gets a specific CPU device.
 /// </summary>
 /// <param name="kind">The CPU device kind.</param>
 /// <returns>The CPU device.</returns>
 public static CPUDevice GetDevice(
     CPUDeviceKind kind) =>
 kind <CPUDeviceKind.Default || kind> CPUDeviceKind.Intel
     ? throw new ArgumentOutOfRangeException(nameof(kind))
     : All[(int)kind];