Beispiel #1
0
        /// <summary>
        /// Add an input to a pending linker invocation.
        /// </summary>
        /// <param name="data">The input data.  PTX must be NULL-terminated.</param>
        /// <param name="type">The type of the input data.</param>
        /// <param name="name">An optional name for this input in log messages.</param>
        /// <param name="options">Collection of linker and compiler options</param>
        public void AddData(System.IO.Stream data, CUJITInputType type, string name, CudaJitOptionCollection options)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            byte[] dataArray = new byte[data.Length];

            int bytesToRead = (int)data.Length;

            data.Position = 0;
            while (bytesToRead > 0)
            {
                bytesToRead -= data.Read(dataArray, (int)data.Position, bytesToRead);
            }
            data.Position = 0;

            AddData(dataArray, type, name, options);
        }
Beispiel #2
0
        /// <summary>
        /// Add an input to a pending linker invocation.
        /// </summary>
        /// <param name="filename">Path to the input file.</param>
        /// <param name="type">The type of the input data.</param>
        /// <param name="options">Collection of linker and compiler options</param>
        public void AddFile(string filename, CUJITInputType type, CudaJitOptionCollection options)
        {
            if (options == null)
            {
                res = DriverAPINativeMethods.ModuleManagement.cuLinkAddFile(_state, type, filename, 0, null, null);
                Debug.Write("");                //Line(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkAddFile", res));
                if (res != CUResult.Success)
                {
                    throw new CudaException(res);
                }
            }
            else
            {
                res = DriverAPINativeMethods.ModuleManagement.cuLinkAddFile(_state, type, filename, (uint)options.Count, options.Options, options.Values);
                Debug.Write("");                //Line(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkAddFile", res));

                if (res != CUResult.Success)
                {
                    throw new CudaException(res);
                }
            }
        }
Beispiel #3
0
 public static extern CUResult cuLinkAddFile(CUlinkState state, CUJITInputType type, string path, uint numOptions, CUJITOption[] options, IntPtr[] optionValues);
Beispiel #4
0
            public static extern CUResult cuLinkAddData(CUlinkState state, CUJITInputType type, byte[] data, SizeT size, [MarshalAs(UnmanagedType.LPStr)] string name,
				uint numOptions, CUJITOption[] options, IntPtr[] optionValues);
Beispiel #5
0
		/// <summary>
		/// Add an input to a pending linker invocation.
		/// </summary>
		/// <param name="filename">Path to the input file.</param>
		/// <param name="type">The type of the input data.</param>
		/// <param name="options">Collection of linker and compiler options</param>
		public void AddFile(string filename, CUJITInputType type, CudaJitOptionCollection options)
		{
			if (options == null)
			{
				res = DriverAPINativeMethods.ModuleManagement.cuLinkAddFile(_state, type, filename, 0, null, null);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkAddFile", res));
				if (res != CUResult.Success)
					throw new CudaException(res);
			}
			else
			{
				res = DriverAPINativeMethods.ModuleManagement.cuLinkAddFile(_state, type, filename, (uint)options.Count, options.Options, options.Values);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkAddFile", res));

				if (res != CUResult.Success)
					throw new CudaException(res);
			}
		}
Beispiel #6
0
		/// <summary>
		/// Add an input to a pending linker invocation.
		/// </summary>
		/// <param name="data">The input data.  PTX must be NULL-terminated.</param>
		/// <param name="type">The type of the input data.</param>
		/// <param name="name">An optional name for this input in log messages.</param>
		/// <param name="options">Collection of linker and compiler options</param>
		public void AddData(System.IO.Stream data, CUJITInputType type, string name, CudaJitOptionCollection options)
		{
			if (data == null) throw new ArgumentNullException("data");
			byte[] dataArray = new byte[data.Length];

			int bytesToRead = (int)data.Length;
			data.Position = 0;
			while (bytesToRead > 0)
			{
				bytesToRead -= data.Read(dataArray, (int)data.Position, bytesToRead);
			}
			data.Position = 0;

			AddData(dataArray, type, name, options);
		}