fixed some warnings and errors under g++
This commit is contained in:
parent
97b0335ef6
commit
50429d8a3e
@ -99,8 +99,8 @@ namespace cv
|
||||
|
||||
string name() const { return name_; }
|
||||
|
||||
int major() const { return major_; }
|
||||
int minor() const { return minor_; }
|
||||
int majorVersion() const { return majorVersion_; }
|
||||
int minorVersion() const { return minorVersion_; }
|
||||
|
||||
int multiProcessorCount() const { return multi_processor_count_; }
|
||||
|
||||
@ -118,7 +118,8 @@ namespace cv
|
||||
|
||||
string name_;
|
||||
int multi_processor_count_;
|
||||
int major_, minor_;
|
||||
int majorVersion_;
|
||||
int minorVersion_;
|
||||
};
|
||||
|
||||
//////////////////////////////// Error handling ////////////////////////
|
||||
|
@ -1258,7 +1258,7 @@ Size cv::gpu::ConvolveBuf::estimateBlockSize(Size result_size, Size templ_size)
|
||||
Size bsize_min(1024, 1024);
|
||||
|
||||
// Check whether we use Fermi generation or newer GPU
|
||||
if (DeviceInfo().major() >= 2)
|
||||
if (DeviceInfo().majorVersion() >= 2)
|
||||
{
|
||||
bsize_min.width = 2048;
|
||||
bsize_min.height = 2048;
|
||||
@ -1295,7 +1295,6 @@ void cv::gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result,
|
||||
|
||||
Size& block_size = buf.block_size;
|
||||
Size& dft_size = buf.dft_size;
|
||||
int& spect_len = buf.spect_len;
|
||||
|
||||
GpuMat& image_block = buf.image_block;
|
||||
GpuMat& templ_block = buf.templ_block;
|
||||
|
@ -175,23 +175,20 @@ size_t cv::gpu::DeviceInfo::totalMemory() const
|
||||
|
||||
bool cv::gpu::DeviceInfo::has(cv::gpu::GpuFeature feature) const
|
||||
{
|
||||
if (feature == NATIVE_DOUBLE)
|
||||
return major() > 1 || (major() == 1 && minor() >= 3);
|
||||
if (feature == ATOMICS)
|
||||
return major() > 1 || (major() == 1 && minor() >= 1);
|
||||
return false;
|
||||
int version = majorVersion() * 10 + minorVersion();
|
||||
return version >= feature;
|
||||
}
|
||||
|
||||
|
||||
bool cv::gpu::DeviceInfo::isCompatible() const
|
||||
{
|
||||
// Check PTX compatibility
|
||||
if (TargetArchs::hasEqualOrLessPtx(major(), minor()))
|
||||
if (TargetArchs::hasEqualOrLessPtx(majorVersion(), minorVersion()))
|
||||
return true;
|
||||
|
||||
// Check BIN compatibility
|
||||
for (int i = minor(); i >= 0; --i)
|
||||
if (TargetArchs::hasBin(major(), i))
|
||||
for (int i = minorVersion(); i >= 0; --i)
|
||||
if (TargetArchs::hasBin(majorVersion(), i))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -204,8 +201,8 @@ void cv::gpu::DeviceInfo::query()
|
||||
cudaSafeCall(cudaGetDeviceProperties(&prop, device_id_));
|
||||
name_ = prop.name;
|
||||
multi_processor_count_ = prop.multiProcessorCount;
|
||||
major_ = prop.major;
|
||||
minor_ = prop.minor;
|
||||
majorVersion_ = prop.major;
|
||||
minorVersion_ = prop.minor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ bool cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable()
|
||||
|
||||
DeviceInfo device_info;
|
||||
|
||||
if (device_info.major() > 1 || device_info.multiProcessorCount() > 16)
|
||||
if (device_info.majorVersion() > 1 || device_info.multiProcessorCount() > 16)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -59,9 +59,12 @@ int main()
|
||||
|
||||
for (int i = 0; i < num_devices; ++i)
|
||||
{
|
||||
if (!DeviceInfo(i).isCompatible())
|
||||
DeviceInfo dev_info(i);
|
||||
if (!dev_info.isCompatible())
|
||||
{
|
||||
cout << "GPU module isn't built for GPU #" << i << " (" << DeviceInfo(i).name() << ")";
|
||||
cout << "GPU module isn't built for GPU #" << i << " ("
|
||||
<< dev_info.name() << ", CC " << dev_info.majorVersion()
|
||||
<< dev_info.minorVersion() << "\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -131,4 +134,4 @@ void destroyContexts()
|
||||
safeCall(cuCtxDestroy(contexts[1]));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -84,9 +84,12 @@ int main(int argc, char** argv)
|
||||
|
||||
for (int i = 0; i < num_devices; ++i)
|
||||
{
|
||||
if (!DeviceInfo(i).isCompatible())
|
||||
DeviceInfo dev_info(i);
|
||||
if (!dev_info.isCompatible())
|
||||
{
|
||||
cout << "GPU module isn't built for GPU #" << i << " (" << DeviceInfo(i).name() << ")";
|
||||
cout << "GPU module isn't built for GPU #" << i << " ("
|
||||
<< dev_info.name() << ", CC " << dev_info.majorVersion()
|
||||
<< dev_info.minorVersion() << "\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ struct CV_GpuMeanShiftTest : public CvTest
|
||||
cv::Mat img = cv::imread(std::string(ts->get_data_path()) + "meanshift/cones.png");
|
||||
cv::Mat img_template;
|
||||
|
||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) && cv::gpu::DeviceInfo().major() >= 2)
|
||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) &&
|
||||
cv::gpu::DeviceInfo().has(cv::gpu::COMPUTE_20))
|
||||
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result.png");
|
||||
else
|
||||
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result_CC1X.png");
|
||||
@ -199,7 +200,8 @@ struct CV_GpuMeanShiftProcTest : public CvTest
|
||||
cv::Mat spmap_template;
|
||||
cv::FileStorage fs;
|
||||
|
||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) && cv::gpu::DeviceInfo().major() >= 2)
|
||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) &&
|
||||
cv::gpu::DeviceInfo().has(cv::gpu::COMPUTE_20))
|
||||
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap.yaml", cv::FileStorage::READ);
|
||||
else
|
||||
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap_CC1X.yaml", cv::FileStorage::READ);
|
||||
|
@ -69,7 +69,7 @@ struct CV_GpuMeanShiftSegmentationTest : public CvTest {
|
||||
{
|
||||
stringstream path;
|
||||
path << ts->get_data_path() << "meanshift/cones_segmented_sp10_sr10_minsize" << minsize;
|
||||
if (TargetArchs::builtWith(COMPUTE_20) && DeviceInfo().major() >= 2)
|
||||
if (TargetArchs::builtWith(COMPUTE_20) && DeviceInfo().has(COMPUTE_20))
|
||||
path << ".png";
|
||||
else
|
||||
path << "_CC1X.png";
|
||||
@ -103,4 +103,4 @@ struct CV_GpuMeanShiftSegmentationTest : public CvTest {
|
||||
|
||||
ts->set_failed_test_info(CvTS::OK);
|
||||
}
|
||||
} ms_segm_test;
|
||||
} ms_segm_test;
|
||||
|
Loading…
x
Reference in New Issue
Block a user