Skip to content
Snippets Groups Projects
Commit d5f15e1e authored by Eric Wait's avatar Eric Wait
Browse files

Added the device name to the mutex txt file.

parent 3c4cc139
No related tags found
No related merge requests found
Showing
with 102 additions and 21 deletions
......@@ -7,7 +7,8 @@ function imageOut = AddConstant(imageIn,additive)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -24,6 +25,9 @@ function imageOut = AddConstant(imageIn,additive)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -8,7 +8,8 @@ function imageOut = AddImageWith(imageIn1,imageIn2,factor)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -25,6 +26,9 @@ function imageOut = AddImageWith(imageIn1,imageIn2,factor)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -10,7 +10,8 @@ function imageOut = ApplyPolyTransformation(imageIn,a,b,c,min,max)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -27,6 +28,9 @@ function imageOut = ApplyPolyTransformation(imageIn,a,b,c,min,max)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -80,8 +80,9 @@ for i=1:length(dList)
fprintf(f, ' %% check for Cuda capable devices\n');
fprintf(f, ' curPath = which(''ImProc.Cuda'');\n');
fprintf(f, ' curPath = fileparts(curPath);\n');
fprintf(f, ' n = ImProc.Cuda.DeviceCount();\n');
fprintf(f, '\n');
fprintf(f, ' devStats = ImProc.Cuda.DeviceStats();\n');
fprintf(f, ' n = length(devStats);\n');
fprintf(f, ' \n');
fprintf(f, ' %% if there are devices find the availble one and grab the mutex\n');
fprintf(f, ' if (n>0)\n');
fprintf(f, ' foundDevice = false;\n');
......@@ -96,7 +97,11 @@ for i=1:length(dList)
fprintf(f, ' catch errMsg\n');
fprintf(f, ' continue;\n');
fprintf(f, ' end\n');
fprintf(f, ' \n');
fprintf(f, ' foundDevice = true;\n');
fprintf(f, ' f = fopen(mutexfile,''at'');\n');
fprintf(f, ' fprintf(f,''%s'',devStats(deviceIdx).name);\n');
fprintf(f, ' fclose(f);\n');
fprintf(f, ' device = deviceIdx;\n');
fprintf(f, ' break;\n');
fprintf(f, ' end\n');
......
......@@ -10,7 +10,8 @@ function imageOut = ContrastEnhancement(imageIn,sigma,MedianNeighborhood)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -27,6 +28,9 @@ function imageOut = ContrastEnhancement(imageIn,sigma,MedianNeighborhood)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -7,7 +7,8 @@ function imageOut = GaussianFilter(imageIn,sigma)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -24,6 +25,9 @@ function imageOut = GaussianFilter(imageIn,sigma)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -11,7 +11,8 @@ function histogram = Histogram(imageIn,numBins,min,max)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -28,6 +29,9 @@ function histogram = Histogram(imageIn,numBins,min,max)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -7,7 +7,8 @@ function imageOut = ImagePow(imageIn,power)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -24,6 +25,9 @@ function imageOut = ImagePow(imageIn,power)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = LinearUnmixing(mixedImages,unmixMatrix)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = LinearUnmixing(mixedImages,unmixMatrix)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MarkovRandomFieldDenoiser(imageIn,maxIterations)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MarkovRandomFieldDenoiser(imageIn,maxIterations)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MaxFilterEllipsoid(imageIn,radius)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MaxFilterEllipsoid(imageIn,radius)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MaxFilterKernel(imageIn,kernel)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MaxFilterKernel(imageIn,kernel)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MaxFilterNeighborhood(imageIn,Neighborhood)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MaxFilterNeighborhood(imageIn,Neighborhood)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MeanFilter(imageIn,Neighborhood)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MeanFilter(imageIn,Neighborhood)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MedianFilter(imageIn,Neighborhood)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MedianFilter(imageIn,Neighborhood)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MinFilterEllipsoid(imageIn,radius)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MinFilterEllipsoid(imageIn,radius)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MinFilterKernel(imageIn,kernel)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MinFilterKernel(imageIn,kernel)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MinFilterNeighborhood(imageIn,Neighborhood)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MinFilterNeighborhood(imageIn,Neighborhood)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function [min,max] = MinMax(imageIn)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function [min,max] = MinMax(imageIn)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
......@@ -3,7 +3,8 @@ function imageOut = MorphologicalClosure(imageIn,kernel)
% check for Cuda capable devices
curPath = which('ImProc.Cuda');
curPath = fileparts(curPath);
n = ImProc.Cuda.DeviceCount();
devStats = ImProc.Cuda.DeviceStats();
n = length(devStats);
% if there are devices find the availble one and grab the mutex
if (n>0)
......@@ -20,6 +21,9 @@ function imageOut = MorphologicalClosure(imageIn,kernel)
continue;
end
foundDevice = true;
f = fopen(mutexfile,'at');
fprintf(f,'%s',devStats(deviceIdx).name);
fclose(f);
device = deviceIdx;
break;
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment