Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7875 Discussions

Differences between classic C++ and DP C++ compiler

Ian_Chivers
New Contributor I
622 Views

I have a follow up to the previous post. the following example compiles and runs to completion using the classic compiler. 

 

Here are the source files.

 

Main driving program

 

/*

The following defines are required by the Intel compiler

*/

#define and &&
#define not !
#define or ||

#include <execution>
#include <iostream>
#include <algorithm>
#include <vector>
#include <random>
#include <string>
#include <chrono>
#include <boost/sort/sort.hpp>

using namespace std;
using namespace boost::sort;

#include "timer.cxx"
#include "print_time.cxx"

// #include "swap.cxx"
// #include "quicksort.cxx"
// #include "print_10.cxx"

int main()
{
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
default_random_engine engine_01(seed);
uniform_real_distribution<double>
distribution_01(0.0, 1.0);

string heading;
double t;
timer timer_01;
timer timer_02;

heading = "Program starts";
t = timer_01.elapsed();
print_time(heading, t);
timer_01.reset();

// Size

const int mega_byte = 1024 * 1024;
const int array_size = 128 * mega_byte;

int i;
vector<double> x(array_size);

cout << "\n C++ standard <vector> \n" << endl;

cout.width(16);
cout << array_size << endl;
cout.width(16);
cout << (array_size * 8);
cout << " bytes " << endl;

for (i = 0; i < array_size; i++)
x[i] = distribution_01(engine_01);

heading = "Random numbers";

t = timer_01.elapsed();
print_time(heading, t);
timer_01.reset();

boost::sort::parallel_stable_sort(x.begin(), x.end());

heading = "Boost sort";

t = timer_01.elapsed();
print_time(heading, t);
timer_01.reset();

heading = "Total time";
t = timer_02.elapsed();
print_time(heading, t);

return(0);

}

#######

timer.cxx

#######

 

#include <chrono>

using namespace std;

class timer
{
public:
timer() : start_timing(hi_res_clock::now()) {}
void reset()
{
start_timing = hi_res_clock::now();
}
double elapsed() const
{
return(std::chrono::duration_cast<second_>
(hi_res_clock::now() - start_timing).count());
}
private:
typedef std::chrono::high_resolution_clock hi_res_clock;
typedef std::chrono::duration<double, std::ratio<1> >
second_;
std::chrono::time_point<hi_res_clock> start_timing;
};

 

###########

print_time.cxx

###########

 

void print_time(const string & heading, const double & t)
{
int nb=32;
int l = heading.length();
int i;
cout << heading << " : ";
for (i=1;i<nb-l;i++) cout << " ";
cout.setf(ios::right);
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
cout.width(10);
cout.precision(6);
cout << t << endl;
}

 

Here is the classic output.

 

C:\document\cpp\examples>ch3806_intel_classic.exe
Program starts : 0.000000

C++ standard <vector>

134217728
1073741824 bytes
Random numbers : 0.930613
Boost sort : 1.671356
Total time : 2.605182

C:\document\cpp\examples>

 

Using the replacement Intel compiler I get

the following compilation error messages.

 


C:\document\cpp\examples>icx /EHsc /nologo /F4294967295 /I "c:\local\boost_1_80_0" /O2 /Qstd=c++20 ch3806.cxx -o ch3806_intel_new.exe
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:22:
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(160,16): error: no member named 'get_temporary_buffer' in namespace 'std'
ptr = std::get_temporary_buffer<value_t>(nptr).first;
~~~~~^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:22:
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(160,37): error: unexpected type name 'value_t': expected expression
ptr = std::get_temporary_buffer<value_t>(nptr).first;
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(160,51): error: member reference base type 'size_t' (aka 'unsigned long long') is not a structure or union
ptr = std::get_temporary_buffer<value_t>(nptr).first;
~~~~~~^~~~~~
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:17:
c:\local\boost_1_80_0\boost/sort/spinsort/spinsort.hpp(480,20): error: no member named 'get_temporary_buffer' in namespace 'std'
ptr = std::get_temporary_buffer<value_t>(nptr).first;
~~~~~^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(136,9): note: in instantiation of member function
'boost::sort::spin_detail::spinsort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::spinsort' requested here
bss::spinsort<Iter_t, Compare>
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(70,7): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
: parallel_stable_sort (first, last, Compare(),
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:17:
c:\local\boost_1_80_0\boost/sort/spinsort/spinsort.hpp(480,41): error: unexpected type name 'value_t': expected expression
ptr = std::get_temporary_buffer<value_t>(nptr).first;
^
c:\local\boost_1_80_0\boost/sort/spinsort/spinsort.hpp(480,55): error: member reference base type 'size_t' (aka 'unsigned long long') is not a structure or union
ptr = std::get_temporary_buffer<value_t>(nptr).first;
~~~~~~^~~~~~
c:\local\boost_1_80_0\boost/sort/spinsort/spinsort.hpp(419,44): error: no type named 'return_temporary_buffer' in namespace 'std'
if (owner and ptr != nullptr) std::return_temporary_buffer(ptr);
~~~~~^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(70,7): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
: parallel_stable_sort (first, last, Compare(),
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:21:
c:\local\boost_1_80_0\boost/sort/sample_sort/sample_sort.hpp(291,29): error: no member named 'get_temporary_buffer' in namespace 'std'
value_t *ptr = std::get_temporary_buffer<value_t>(nelem).first;
~~~~~^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(174,9): note: in instantiation of member function
'boost::sort::sample_detail::sample_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::sample_sort' requested here
sample_sort<Iter_t, Compare>
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(70,7): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
: parallel_stable_sort (first, last, Compare(),
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:21:
c:\local\boost_1_80_0\boost/sort/sample_sort/sample_sort.hpp(291,50): error: unexpected type name 'value_t': expected expression
value_t *ptr = std::get_temporary_buffer<value_t>(nelem).first;
^
c:\local\boost_1_80_0\boost/sort/sample_sort/sample_sort.hpp(291,65): error: member reference base type 'size_t' (aka 'unsigned long long') is not a structure or union
value_t *ptr = std::get_temporary_buffer<value_t>(nelem).first;
~~~~~~~^~~~~~
c:\local\boost_1_80_0\boost/sort/sample_sort/sample_sort.hpp(334,14): error: no member named 'return_temporary_buffer' in namespace 'std'
std::return_temporary_buffer(global_buf.first);
~~~~~^
c:\local\boost_1_80_0\boost/sort/sample_sort/sample_sort.hpp(140,7): note: in instantiation of member function
'boost::sort::sample_detail::sample_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::sample_sort' requested here
: sample_sort(first, last, cmp, num_thread,
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(174,9): note: in instantiation of member function
'boost::sort::sample_detail::sample_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::sample_sort' requested here
sample_sort<Iter_t, Compare>
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(70,7): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
: parallel_stable_sort (first, last, Compare(),
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
In file included from ch3806.cxx:12:
In file included from c:\local\boost_1_80_0\boost/sort/sort.hpp:22:
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(91,34): error: no type named 'return_temporary_buffer' in namespace 'std'
if (ptr != nullptr) std::return_temporary_buffer(ptr);
~~~~~^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(70,7): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
: parallel_stable_sort (first, last, Compare(),
^
c:\local\boost_1_80_0\boost/sort/parallel_stable_sort/parallel_stable_sort.hpp(236,5): note: in instantiation of member function
'boost::sort::stable_detail::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>, std::less<double>>::parallel_stable_sort' requested here
stable_detail::parallel_stable_sort<Iter_t, Compare>(first, last);
^
ch3806.cxx(66,16): note: in instantiation of function template specialization 'boost::sort::parallel_stable_sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>>' requested here
boost::sort::parallel_stable_sort(x.begin(), x.end());
^
12 errors generated.

 

Any thoughts?

 

 

 

 

 

 

 

 

0 Kudos
6 Replies
SeshaP_Intel
Moderator
577 Views

Hi,


Thank you for posting in Intel Communities.

We were able to reproduce your issue. We have informed the development team about it.

We will get back to you soon.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Ian_Chivers
New Contributor I
535 Views

Thanks very much for getting back so quickly. I'm in the process of moving from the classic compiler to the replacement and just wanted to bring the difference between the two to your attention.

0 Kudos
SeshaP_Intel
Moderator
410 Views

Hi,

 

Sorry for the delay in the response.

Boost relies on APIs that produce errors/warnings with newer c++ standards. For example, std::get_temporary_buffer() (used by Boost) is deprecated starting from c++17. You can refer to the below link for more details.

https://mariusbancila.ro/blog/2018/07/05/c17-removed-and-deprecated-features/

 

You can use /Qstd=c++17 as the workaround. icx produces warnings instead of errors and the executable runs successfully.

Please refer to the below screenshot for the output.

output.PNG

 

Thanks and Regards,

Pendyala Sesha Srinivas

0 Kudos
SeshaP_Intel
Moderator
369 Views

Hi,


Has the information provided above helped? If yes, could you please confirm whether we can close this thread from our end?


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Ian_Chivers
New Contributor I
360 Views

I apologise for not getting back sooner. My main concern was to bring to your attention differences between the Intel classic compiler and its replacement. You can close the tread as far as I'm concerned. 

0 Kudos
SeshaP_Intel
Moderator
341 Views

Hi,


Thanks for the confirmation. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.


Thanks and Regards,

Pendyala Sesha Srinivas


0 Kudos
Reply