コード例 #1
0
ファイル: FlatVolume.hpp プロジェクト: marwan-abdellah/cuYURI
void FlatVolume<T>::AllocateVolume()
{
    INFO("Allocating the volume : " +
         ITS(NXYZ) + CATS(" voxels") + CATS(" - ") +
         ITS(volumeSize) + CATS(" Bytes"));

    // Volume allocation
    this->ptrVolumeData = (T*) malloc (volumeSize);

    INFO("The FLAT volume has been successfully allocated in 1D array");
}
コード例 #2
0
ファイル: FlatVolume.hpp プロジェクト: marwan-abdellah/cuYURI
void FlatVolume<T>::FreeVolume()
{
    INFO("Freeing a volume data block of size: " +
         CATS("[") + ITS(NX) + CATS("] X [") +
         ITS(NY) + CATS("] X [") + ITS(NZ) + CATS("]") +
         CATS(" - ") + ITS(volumeSize) + " Bytes");

    // Release volume data memory block
    free(this->ptrVolumeData);

    INFO("Freeing volume data has been done successfully");
}
コード例 #3
0
ファイル: Image.hpp プロジェクト: marwan-abdellah/cuYURI
// Constructor
template <class T> Image<T>::Image
(const int NX, const int NY) : NX(NX), NY(NY)
{
    INFO("Creating a 2D Image object of size : " +
         CATS("[") + ITS(NX) + CATS("] X [") + ITS(NY) + CATS("]"));

    // Total number of pixels in the image
    this->NXY = NX * NY;

    // Image size in Bytes
    ImageSize = sizeof(T) * this->NXY;

    // Allocating the Image data memory block
    Image::AllocateImage();
}
コード例 #4
0
ファイル: FlatVolume.hpp プロジェクト: marwan-abdellah/cuYURI
// Constructor
template <class T> FlatVolume<T>::FlatVolume
(const int NX, const int NY, const int NZ) : NX(NX), NY(NY), NZ(NZ)
{
    INFO("Creating a FLAT volume object of size : " +
         CATS("[") + ITS(NX) + CATS("] X [") +
         ITS(NY) + CATS("] X [") + ITS(NZ) + CATS("]"));

    // Total number of voxels in the volume
    NXYZ = NX * NY * NZ;

    // Volume size in Bytes
    volumeSize = sizeof(T) * NXYZ;

    FlatVolume::AllocateVolume();
}
コード例 #5
0
ファイル: Image.hpp プロジェクト: marwan-abdellah/cuYURI
void Image<T>::AllocateImage()
{
    INFO("Allocating a 2D Image : " +
         ITS(this->NXY) + CATS(" pixels") + CATS(" - ") +
         ITS(this->ImageSize) + CATS(" Bytes"));

    // 2D Image allocation
    this->ptrImageData = (T**) malloc (sizeof(T*) * this->NX);

    for(int j = 0; j < this->NX; j++)
    {
        this->ptrImageData[j] = (T*) malloc (sizeof(T) * this->NY);
    }

    INFO("The Image has been successfully allocated 3D array");
}
コード例 #6
0
ファイル: cuUtilities.cpp プロジェクト: maismail/cuYURI
void cuUtils::DisplayKernelProfilingData(char* kernelName, cuProfile* profile)
{
    COUT << TAB; SEP();
    COUT << TAB << "Kernel Execution Time @[" << CATS(kernelName)  << "]" << ENDL;
    COUT << TAB << TAB << "@Nano-Seconds (ns)  : " << (profile->kernelDuration * (1000 * 1000)) << ENDL;
    COUT << TAB << TAB << "@Micro-Seconds (us) : " << (profile->kernelDuration * 1000) << ENDL;
    COUT << TAB << TAB << "@Milli-Seconds (ms) : " <<  profile->kernelDuration << ENDL;
    COUT << TAB << TAB << "@Seconds (s)        : " << (profile->kernelDuration / (1000)) << ENDL;
    COUT << TAB; SEP();
}
コード例 #7
0
ファイル: LoadingVolume.hpp プロジェクト: maismail/cuYURI
void ReadVolume(char *prefix)
{
    char imgFile[100];
    ifstream inputFileStream;

    // Reading the header file
    ReadHeader(prefix, iWidth, iHeight, iDepth);
    INFO("Volume size: [" + ITS(iWidth) + "X" +
         ITS(iHeight) + "x" + ITS(iDepth) + "]");

    // Adding the ".img" prefix to the dataset path
    sprintf(imgFile, "%s.img", prefix);
    INFO("Reading the volume file " + CATS(imgFile));

    // Total number of voxels
    numVoxels = iWidth * iHeight * iDepth;
    INFO("Number of voxels : " + ITS(numVoxels));

    // Allocating the luminance image
    luminanceImage = new GLubyte [numVoxels];

    // Allocating the RGBA image
    rgbaImage = new GLubyte [numVoxels * 4];

    // Reading the volume image (luminance values)
    inputFileStream.open(imgFile, ios::in);
    if (inputFileStream.fail())
    {
        INFO("Could not open " + CATS(imgFile));
        EXIT(0);
    }

    // Read the image byte by byte
    inputFileStream.read((char *)luminanceImage, numVoxels);

    // Closing the input volume stream
    inputFileStream.close();

    // Update the volume
    UpdateVolume();

    INFO("The volume has been read successfull and the RGBA one is DONE");
}
コード例 #8
0
ファイル: Image.hpp プロジェクト: marwan-abdellah/cuYURI
void Image<T>::FreeImage()
{
    INFO("Freeing a 3D Image data block of size: " +
         CATS("[") + ITS(this->NX) + CATS("] X [") +
         ITS(this->NY) + CATS("]") + CATS(" - ") +
         ITS(this->ImageSize) + " Bytes");

    for(int j = 0; j < this->NY; j++)
    {
        // Release Y
        free(this->ptrImageData[j]);
    }

    // Release X
    free(this->ptrImageData);

    // Nulling the dangling pointer
    this->ptrImageData = NULL;

    INFO("Freeing 2D Image data has been done successfully");
}
コード例 #9
0
void ex_RealArray::DumpNumbers_Single()
{
	INFO("ex_RealArray - Single Precision");

	// Create the XL book
	xlBook = Utils::xl::createBook();
	INFO("xlBook created : " + CATS(xlBookName_Single));
	SEP();

	if(xlBook)
	{
		/**********************************************************
		 * 1D Case
		 **********************************************************/
		xlSheet = Utils::xl::addSheetToBook("1D", xlBook);

		if (xlSheet)
		{
			INFO("** 1D Case");

			size_N = size_X;

			// Allocation
			floatArray_1D = MEM_ALLOC_1D(float, size_N);
			INFO("Array allocation done");

			// Filling array (Sequential)
			Array::fillArray_1D_float(floatArray_1D, size_N, 1);
			INFO("Filing array done - Sequential");

			// Headers
			xlSheet->writeStr(1, 0, "Seq");

			// Filling column with data
			for (int j = 0; j < size_N; j++)
				xlSheet->writeNum(j + 2, 0, floatArray_1D[j]);

			// Filling array (Random)
			Array::fillArray_1D_float(floatArray_1D, size_N, 0);
			INFO("Filing array done - Random");

			// Headers
			xlSheet->writeStr(1, 1, "Rnd");

			// Filling column with data
			for (int j = 0; j < size_N; j++)
				xlSheet->writeNum(j + 2, 1, floatArray_1D[j]);


			// Freeing memory
			FREE_MEM_1D(floatArray_1D);
			INFO("Freeing memory");
		}
		else
		{
			INFO("No valid xlSheet was created, EXITTING ...");
			EXIT(0);
		}

		SEP();

		/**********************************************************
		 * 2D Flat Case
		 **********************************************************/
		xlSheet = Utils::xl::addSheetToBook("Flat_2D", xlBook);

		if (xlSheet)
		{
			INFO("** 2D Flat Case");

			size_N = size_X * size_Y;

			// Allocation
			floatArray_2D_flat = MEM_ALLOC_1D(float, size_N);
			INFO("Array allocation done");

			// Filling array (Sequential)
			Array::fillArray_2D_flat_float(floatArray_2D_flat, size_X, size_Y, 1);
			INFO("Filing array done - Sequential");

			// Headers
			xlSheet->writeStr(1, 0, "Seq");

			// Filling column with data
			for (int j = 0; j < size_N; j++)
				xlSheet->writeNum(j + 2, 0, floatArray_2D_flat[j]);

			// Filling array (Random)
			Array::fillArray_2D_flat_float(floatArray_2D_flat, size_X, size_Y, 0);
			INFO("Filing array done - Random");

			// Headers
			xlSheet->writeStr(1, 1, "Rnd");

			// Filling column with data
			for (int j = 0; j < size_N; j++)
				xlSheet->writeNum(j + 2, 1, floatArray_2D_flat[j]);

			// Freeing memory
			FREE_MEM_1D(floatArray_2D_flat);
			INFO("Freeing memory");
		}
		else
		{