Ejemplo n.º 1
0
 /// <summary>
 /// Enables a CPU device of the given kind.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <param name="device">The custom CPU device.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder CPU(
     this Context.Builder builder,
     CPUDevice device)
 {
     builder.DeviceRegistry.Register(device);
     return(builder);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Enables all Cuda devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <param name="predicate">
 /// The predicate to include a given device.
 /// </param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder Cuda(
     this Context.Builder builder,
     Predicate <CudaDevice> predicate)
 {
     CudaDevice.GetDevices(
         predicate,
         builder.DeviceRegistry);
     return(builder);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Enables all Cuda devices.
        /// </summary>
        /// <param name="builder">The builder instance.</param>
        /// <param name="predicate">
        /// The predicate to include a given device.
        /// </param>
        /// <returns>The updated builder instance.</returns>
        public static Context.Builder Cuda(
            this Context.Builder builder,
            Predicate <CudaDevice> predicate)
        {
            if (Backend.RuntimePlatform != TargetPlatform.X64)
            {
                throw new NotSupportedException(string.Format(
                                                    RuntimeErrorMessages.CudaPlatformX64,
                                                    Backend.RuntimePlatform));
            }

            CudaDevice.GetDevices(
                predicate,
                builder.DeviceRegistry);
            return(builder);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Enables all compatible Cuda devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder Cuda(this Context.Builder builder) =>
 builder.Cuda(desc =>
              desc.Architecture.HasValue &&
              desc.InstructionSet.HasValue &&
              PTXCodeGenerator.SupportedInstructionSets.Contains(
                  desc.InstructionSet.Value));
Ejemplo n.º 6
0
 /// <summary>
 /// Enables all compatible Cuda devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder Cuda(this Context.Builder builder) =>
 builder.Cuda(desc =>
              desc.Architecture.HasValue &&
              desc.InstructionSet.HasValue);
Ejemplo n.º 7
0
 /// <summary>
 /// Enables all CPU devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder CPU(this Context.Builder builder) =>
 builder.CPU(desc => true);
Ejemplo n.º 8
0
 /// <summary>
 /// Enables the default CPU device (see <see cref="CPUDevice.Default"/>).
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder DefaultCPU(this Context.Builder builder) =>
 builder.CPU(CPUDeviceKind.Default);
Ejemplo n.º 9
0
 /// <summary>
 /// Gets the current intrinsic implementation manager to register new intrinsics.
 /// </summary>
 /// <param name="builder">The current builder instance.</param>
 /// <returns>The current intrinsic manager.</returns>
 public static IntrinsicImplementationManager GetIntrinsicManager(
     this Context.Builder builder) =>
 builder.IntrinsicManager;
Ejemplo n.º 10
0
 /// <summary>
 /// Enables all compatible OpenCL devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder OpenCL(this Context.Builder builder) =>
 builder.OpenCL(id => id.CVersion >= CLBackend.MinimumVersion);
Ejemplo n.º 11
0
 /// <summary>
 /// Enables all compatible OpenCL devices.
 /// </summary>
 /// <param name="builder">The builder instance.</param>
 /// <returns>The updated builder instance.</returns>
 public static Context.Builder OpenCL(this Context.Builder builder) =>
 builder.OpenCL(id => id.CLStdVersion >= CLBackend.MinimumVersion &&
                id.Capabilities.GenericAddressSpace);