Esempio n. 1
0
	static void upload( TObject const & handle,
			std::vector < typename TObject::value_type > const& input,
			context const& ctx,
			bool synchronous = true)
	{
		assert ( ( input.size() / TObject::value_elements ) == handle.get_count() );

		ctx.transfer_to_buffer(handle.get_mem(), &input.front(), handle.value_entry_size * handle.get_count());
	}
Esempio n. 2
0
	static void uploadScalar( TObject const & handle,
			typename TObject::value_type const& input,
			context const& ctx,
			bool synchronous = true)
	{
		assert (   handle.get_count() == 1 );

		ctx.transfer_to_buffer(handle.get_mem(), &input, handle.value_entry_size);
	}
Esempio n. 3
0
	static void createScalar(
			TObject & handle,
			typename TObject::value_type const& initialValue,
			context const & ctx)
	{
		// create buffer
		create ( handle, 1, ctx );

		ctx.transfer_to_buffer(handle.get_mem(), &initialValue, handle.value_entry_size);

        //std::cout << "Buffer written" << std::endl;
	}
Esempio n. 4
0
	static void create(
			TObject & handle,
			std::vector < typename TObject::value_type > const& input,
			size_t count,
			context const & ctx)
	{
		// create buffer
		create ( handle, count, ctx );

		ctx.transfer_to_buffer(handle.get_mem(), &input.front(), handle.value_entry_size * count);
        //std::cout << "Buffer written" << std::endl;
	}
Esempio n. 5
0
	static void downloadScalar( TObject const & handle,
			typename TObject::value_type & out,
			context const& ctx,
			bool synchronous = true,
			uint offset = 0,
			uint lengthWaitList = 0,
			const cl_event * waitList = NULL)
	{
		assert ( handle.get_count() >= offset );

		offset = offset * handle.value_entry_size;
		ctx.transfer_from_buffer(handle.get_mem(), &out, handle.value_entry_size, lengthWaitList, waitList, offset);
	}