Heat Transfere
Using Texture and Shared Memory
Round Robin
Round robin is one of the simplest scheduling techniques.
Suppose that requests with master id are place to the bus in the following order,
the right most request is the first that arrive and the leftmost the last:
Schedule Request
7 |
3 |
21 |
4 |
87 |
6 |
Round Robbin will give priority to the task with the lowest id.
in this case the order would be as follows:
Round Robin Queue
3 | 4 | 6 | 7 | 21 | 87 |
Where the leftmost entry is the one that has the highest priority and goes next
When a master is given access to the bus, it leaves the Round Robin (RR) Queue and the next one in line will continue,
A pointer to current master who had control is kept.
the following examples showes the execution of 3 schedules:
Round Robin Queue
4 | 6 | 7 | 21 | 87 |
The interesting part comes when new requests are schedule.
4426441022164564
Class definition:
The class is define as follows for
miauu
class CHeatTrasfer{
// Device pointers
vector deviceMatrices;
vector hostMatrices;
// Dimentions of the image
int x,y;
public:
// reference to texture
float *frontTex;
float *backTex;
// Wrapper functions
void blend(float* in, bool swaped);
void cpy_const(float* dest);
~CHeatTrasfer();
CHeatTrasfer(int x1,int y1){x=x1;y=y1;}
float* reserveDeviceFloatMatrix();
float* reserveHostFloatMatrix();
void cudaCopy(float* src,float* dest,cudaMemcpyKind mem);
float* reserveMatrix(bool device);
void setTo(float v,float* dev_mem);
int getTotalSize(){return x*y*sizeof(float);}
dim3 getNBlocks(){
return dim3(x/tX,y/tY);
}
float* initConstTemp();
dim3 getNThreads(){
return dim3(tX,tY);
}
void setUpTextureMemmory(float* dev_const,float* dev_front,float* dev_back);
};
- Definition list
- Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
- Lorem ipsum dolor sit amet
- Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
- This should be four
- Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
- Lorem ipsum dolor sit amet
- Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
#include
#include
class CudaPerformance{
cudaEvent_t start,end;
public:
CudaPerformance(){
cudaEventCreate(&start);
cudaEventCreate(&end);
}
~CudaPerformance(){
( cudaEventDestroy( start ) );
( cudaEventDestroy( end ) );
}
void setStartPoint(){
cudaEventRecord(start,0);
}
float getTime(){
float elapsedTime;
cudaEventRecord(end,0);
cudaEventSynchronize(end);
cudaEventElapsedTime( &elapsedTime,
start, end );
printf( "Time to generate: %3.1f ms\n", elapsedTime );
return elapsedTime;
}
};