Esempio n. 1
0
		/// <summary>
		/// Creates a pending JIT linker invocation.
		/// </summary>
		/// <param name="options">Collection of linker and compiler options</param>
		public CudaLinker(CudaJitOptionCollection options)
		{
			
			_state = new CUlinkState();

			if (options == null) 
				res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate(0, null, null, ref _state);
			else
				res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate((uint)options.Count, options.Options, options.Values, ref _state);

			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkCreate", res));
			if (res != CUResult.Success)
				throw new CudaException(res);
			

		}
Esempio n. 2
0
        /// <summary>
        /// Creates a pending JIT linker invocation.
        /// </summary>
        /// <param name="options">Collection of linker and compiler options</param>
        public CudaLinker(CudaJitOptionCollection options)
        {
            _state = new CUlinkState();

            if (options == null)
            {
                res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate(0, null, null, ref _state);
            }
            else
            {
                res = DriverAPINativeMethods.ModuleManagement.cuLinkCreate((uint)options.Count, options.Options, options.Values, ref _state);
            }

            Debug.Write("");            //Line(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuLinkCreate", res));
            if (res != CUResult.Success)
            {
                throw new CudaException(res);
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
                }
            }
        }
Esempio n. 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);
			}
		}
Esempio n. 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);
		}