Print

Print


Hi Edo,

Well, C++11 is a standard, it's just that nobody quite implements it exactly. Different compilers have more or less features and hover in the vicinity of the standard. https://m.xkcd.com/927/

It doesn't help that boost is viewed as a sort of pre-release for what will go into the standard at a later date - but when they actually put it into the standard it's incompatible with boost (e.g. boost::shared_ptr and std::shared_ptr).

Still, C++11 syntax is nice. lambda functions ftw.

Regarding GPU implementations, thrust is nice. There are also OpenMP and OpenACC, as well as other promising work http://hgpu.org/?p=15487.
And of course PGI to run cuda code on the CPU.

Casper

On 24 August 2017 at 10:15, Edoardo Pasca <[log in to unmask]> wrote:

I agree. I recently stumbled (or better bumped) upon the fact that the so-called C++11 standard is not standard at all and I was forced to remove the dependency from it using some boost library.

 

Thinking about containers (STL vectors), I found the Thrust library which enables to switch from CPU to GPU/multicore-CPU implementations at compile-time. Practically you write one code. Depending on how you compile it you can get an executable for GPU or single thread CPU. I didn’t know about it, so I thought to share it: https://thrust.github.io/

 

Edo

 

From: Thielemans, Kris [mailto:[log in to unmask]]
Sent: 23 August 2017 13:50
To: Pasca, Edoardo (STFC,RAL,SC) <[log in to unmask]>; [log in to unmask]


Subject: RE: build error on VM/Linux

 

Thanks Edo

 

However, I think we had agreed that C++-11 is our minimum standard. It has nice features over older C++ that would enable us to write cleaner code, and using standard libraries is definitely an advantage over using external stuff (even if we already need boost).

 

Kris

 

From: CCP-PETMR Developers list [mailto:CCP-PETMR-DEVEL@JISCMAIL.AC.UK] On Behalf Of Edoardo Pasca
Sent: 23 August 2017 09:39
To: [log in to unmask]
Subject: Re: build error on VM/Linux

 

Alternatively one may think on using boost::posix_time?

http://www.boost.org/doc/libs/1_55_0/doc/html/date_time/posix_time.html#date_time.posix_time.time_duration

 

Edo

 

From: CCP-PETMR Developers list [mailto:CCP-PETMR-DEVEL@JISCMAIL.AC.UK] On Behalf Of Evgueni Ovtchinnikov
Sent: 22 August 2017 11:08
To: [log in to unmask]
Subject: Re: build error on VM/Linux

 

Thanks, it works!

 

From: Thielemans, Kris [mailto:[log in to unmask]]
Sent: 22 August 2017 10:31
To: Ovtchinnikov, Evgueni (STFC,RAL,SC); [log in to unmask]
Subject: RE: build error on VM/Linux

 

Hi

 

My suggested solution requires CMake 3.1. I thought we enforced that, but I guess only in the Superbuild. To be able to cope with older CMake, let’s use what I just put into STIR:

include(cmake/SetC++Version.cmake)

UseCXX(11)

 

 

I’m sure Gadgetron uses an equivalent solution.

 

Kris

From: CCP-PETMR Developers list [mailto:CCP-PETMR-DEVEL@JISCMAIL.AC.UK] On Behalf Of Evgueni Ovtchinnikov
Sent: 22 August 2017 10:05
To: [log in to unmask]
Subject: Re: build error on VM/Linux

 

Thanks, it worked on VM but not on Centos 7, where I still get

 

In file included from /usr/include/c++/4.8.2/chrono:35:0,

                 from /cs/research/external/home/eovtchin/devel/SIRF/src/xSTIR/cSTIR/stir_x.h:26,

                 from /cs/research/external/home/eovtchin/devel/SIRF/src/xSTIR/cSTIR/cstir_p.cpp:26:

/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

 

Could it be because cmake 2.8.12.2 that I have on Centos 7 is too old?

 

Strangely, this never happened when building cgadgetron, where I have been using exactly the same <chrono> stuff for a long time.

 

Perhaps it would be easier to find an alternative portable way of getting time in milliseconds or else an alternative way to name temporary files. Any ideas?

 

From: Thielemans, Kris [mailto:[log in to unmask]]
Sent: 21 August 2017 19:06
To: [log in to unmask]; Ovtchinnikov, Evgueni (STFC,RAL,SC)
Subject: Re: build error on VM/Linux

 

Hi

Did you only recently start using chrono? It's a c++11 library. We'll have to switch the build to use c++11 then if you need it, but that's a good idea anyway.

This can be done by adding

set(CMAKE_CXX_STANDARD 11)

To the toplevel CMakeLists.txt.

Kris Thielemans

Reader in Medical Imaging Physics

UCL

 

From: Evgueni Ovtchinnikov

Sent: Monday 21 August 17:08

Subject: build error on VM/Linux

I am getting this error when trying to build SIRF on VM and Centos 7 machines:

 

In file included from /usr/include/c++/5/chrono:35:0,

                 from /home/sirfuser/devel/SIRF/src/xSTIR/cSTIR/stir_x.h:26,

                 from /home/sirfuser/devel/SIRF/src/xSTIR/cSTIR/cstir_p.cpp:26:

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

 

Any idea what is going on and how to fix it?

 

Thanks,

 

Evgueni