Sending this from my phone, so please excuse the formatting :)

The message is embedded below.
---------- Forwarded message ----------
From: "Musto, Matthew" <mmu...@nyiso.com>
Date: Jul 10, 2014 10:24 AM
Subject:
To: "matthew.mu...@gmail.com" <matthew.mu...@gmail.com>
Cc:

Hi Karli,



Thank you for the quick reply to my random late night thoughts!



>Hi Matt,

>

>> This is more of a curiosity question than anything else.  When I

>> compiled the latest build of ViennaCL this evening, I modified the CMake

>> GUI such that the release flags for CXX and C looked as follows:

>>

>> /MD /GL /Ot /MP /O2 /Ob2 /D NDEBUG

>>

>> Specifically, I added /GL /Ot /MP for global optimization, favoring fast

>> code and multiprocessor compilation.  Who wants to wait for a single

>> thread to compile the whole project?! ;-)

>

>;-)

>

>

>> Anyway, I have two questions.

>>

>> 1) I did not enable /openmp.  What I read here leads me to believe the

>> OpenMP code in ViennaCL will still work if it is explicitly written in

>> the code.  Should I enable this anyway?

>> http://msdn.microsoft.com/en-us/library/fw509c3b.aspx

>

>If you pass /openmp, then you also need to make sure that

>VIENNACL_WITH_OPENMP is defined. The easiest thing to do this is to

>select 'ENABLE_OPENMP' in CMake.

>

>A bit of background information: Standard use of OpenMP through

>pragma-annotations is as follows:

>

>* For-Loop without any extras:

>   for (i=0; i<N; ++i) x[i] = 42;

>

>* For-Loop with parallel execution via OpenMP:

>   #pragma omp parallel for

>   for (i=0; i<N; ++i) x[i] = 42;

>

>Now the problem here is that certain compilers (including MSVC) emit

>warnings if OpenMP is not enabled to make the user aware that the

>#pragma-thing does nothing. Hence, in ViennaCL all OpenMP-parallel

>for-loops are guarded as follows:

>   #ifdef VIENNACL_WITH_OPENMP

>     #pragma omp parallel for

>   #endif

>   for (i=0; i<N; ++i) x[i] = 42;

>

>This allows us to have clean compilations in both cases.

>

>



Thank you for the information :)



>> 2) I assume the other compiler options were pulled by CMake directly

>> from the compiler of my choice and it is not something specified from

>> your configs?  However, If it is in your config, perhaps you can

>> consider adding the above flags to visual studio builds to improve

>> performance and compile times.

>

>Yes, CMake runs a couple of compiler checks and then uses a couple of

>default flags. I think some of the flags you mentioned above are

>actually set if you select 'Release' mode (I'm sure about NDEBUG). Do

>you know about support for the other flags? I'll include them if they

>also work with Express-Editions and all the way back to VS 2005.

>Version-specific checks for Visual Studio is something I'd like to

>avoid, since this CMake's job ;-)



*/MD* – created a multi threaded DLL module and has been supported
through at least VS2005.  This was added by CMake automatically.

*/GL* – enables whole program optimization and has been supported
through at least VS2005.  I added this manually to CMake

*/Ot* - (Favor Fast Code) maximizes the speed of EXEs and DLLs by
instructing the compiler to favor speed over size. Supported through
at least VS2005. I added this manually to CMake

*/MP* – builds with multiple processes rather than one.  Introduced
with VS2008 but would be a nice to have as a default and those using
2005 or .Net 2003 would need to disable it when they get the
unrecognized compiler option notice.

*/O2* – Level 2 optimization, supported through at least VS2005.  This
was added by CMake automatically.

*/Ob2* - Expands functions marked as *inline* or *__inline* and any
other function that the compiler chooses (expansion occurs at the
compiler's discretion, often referred to as auto-inlining). */Ob2* is
in effect when /O1, /O2 (Minimize Size, Maximize Speed)
<http://msdn.microsoft.com/en-us/library/8f8h5cxt%28v=vs.80%29.aspx>
or /Ox (Full Optimization)
<http://msdn.microsoft.com/en-us/library/59a3b321%28v=vs.80%29.aspx>
is used. supported through at least VS2005.  This was added by CMake
automatically

*/D NDEBUG* – disables creation of debug information, supported
through at least VS2005.  This was added by CMake automatically



*/arch:SSE2* – enables the compiler to use SSE2 instructions.  I
actually haven’t tried this yet, nor do I know if your code would
benefit much.  AVX wasn’t added until VS2010 so enabling that by
default probably wouldn’t help much.  I will benchmark this on the CPU
later to see if it makes any difference.  If so, this least common
denominator may be a good addition as well.



If I were going to make a recommendation, I would add */GL /Ot
/arch:SSE2* for sure and */MP *if you feel it is OK to be VS2008
compliant and deprecate VS2005 support (or at least make it clear in
the README they need to flip that off if they want to run on that old
of a system).  I guess the same could be said for */arch:AVX* in lieu
of SSE2 but we are now moving another release forward.  ;-)



Not that I want to be a bad guy, but my thought is if you are trying
to work on cutting edge optimizations you shouldn’t be using a
compiler from almost a decade ago!



-Matt



>

>Best regards,

>Karli



The information in this email is confidential and may be legally privileged
against disclosure other than to the intended recipient. It is intended
solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. Please immediately
delete this message and inform the sender of this error.
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to