Intel OneApi C++ Compiler

Started by MrBcx, March 14, 2025, 08:54:19 PM

Previous topic - Next topic

MrBcx

Compiler optimization would be my hunch.

I get similar results to yours using Pelles C.

Using Clang, I get

It took  169.2583 [ms] to complete.
Results:  7051.57119764641

I don't have the Intel compiler on my PC at my location.

RAW

A small benchmark program shows surprising results for BCX:
Approximate values for an i5-1135G7 are:
- PellesC: 542 ms
- MinGW++: 348 ms (-O3)
- icx: 58 ms


'$NOWIN
'$LEANANDMEAN

Dim i
Dim as double MilliSeconds, x = 1.0

Print "Prime numbers from 0 to 99.999.998 ..."
Print "Benchmark for Windows with BCX - 64 bit"

Tix_Start
'
  For i = 0 To 99999998       
    x = (((i+i+2*i)+0.621) / x)
    ' or this:  x = (i+i+2*i+1-0.379)/(x)
  Next
'
MilliSeconds = TIX_NOW
Print "It took " & MilliSeconds & " [ms] to complete."
Print "Results: " & x

Pause


C:\Compilers\BED>"C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
:: initializing oneAPI environment...
  Initializing Visual Studio command-line environment...
  Visual Studio version 17.14.2 environment configured.
  "C:\Program Files\Microsoft Visual Studio\2022\Community\"
  Visual Studio command-line environment initialized for: 'x64'
:  compiler -- latest
:  debugger -- latest
:  dev-utilities -- latest
:  dpl -- latest
:  ocloc -- latest
:  tbb -- latest
:  umf -- latest
:: oneAPI environment initialized ::

C:\Compilers\BED>icx Prime_BCX.c
Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.1.1 Build 20250418
Copyright (C) 1985-2025 Intel Corporation. All rights reserved.


C:\Compilers\BED>Prime_BCX.exe
Prime numbers from 0 to 99.999.998 ...
Benchmark for Windows with BCX - 64 bit
It took  54.9805 [ms] to complete.
Results:  7051.57119764041

Press any key to continue . . .


What happened?

MrBcx

@Quin --- when optimizing for speed ( /O2 ), exe sizes are all comparable .. approx 1.2MB

@JBK --- I'm certain you're right.  The Intel DPC++ compiler is made for data-parallel
C++ code that can run on various hardware -- CPUs, GPUs, and FPGAs but I'm not into that.


jbk

it's my experience that for certain code, the Intel compiler produces exes that are significantly faster than that of MSVC, so I wouldn't discount Intel just yet.

Quin

Cool stuff! Although it is fascinating that you didn't really notice -any- speed improvements. How's the binary size compared with msvc/mingw?

MrBcx

#1
I fed my curiosity today by installing the latest Intel OneApi C++ Compiler for Windows, a LLVM-based compiler that
requires Microsoft Visual Studio integration, in order to access Microsoft's headers, libs, etc, similar to Clang.

Long story short, I successfully built my latest version of BCX using the Intel C++ compiler. 

That's cool and now my curiosity has been satisfied.

The resulting BCX executable runs just as fast as when compiled using the vanilla version of Clang (20.1.0).

In other words, the Intel compiler didn't knock my socks off like I was expecting it to.





C:\Bc>REM Set up Intel compiler environment

C:\Bc>call "C:\Intelc++\2025.0\oneapi-vars.bat"
:: initializing oneAPI environment...
   Initializing Visual Studio command-line environment...
   Visual Studio version 17.13.2 environment configured.
   "C:\Program Files\Microsoft Visual Studio\2022\Community\"
   Visual Studio command-line environment initialized for: 'x64'
:: compiler -- processing etc\compiler\vars.bat
:: debugger -- processing etc\debugger\vars.bat
:: dpl -- processing etc\dpl\vars.bat
:: mkl -- processing etc\mkl\vars.bat
:: tbb -- processing etc\tbb\vars.bat
:: oneAPI environment initialized ::

BCX BASIC to C/C++ Translator (c) 1999-2025 by Kevin Diggins
Version 8.2.6 (03/14/2025) Compiled using Intel C++ (2025.0.4) for 64-bit Windows
[Lines In: 38703] [Lines Out: 41980] [Statements: 34282] [Time: 0.93 Sec's]
BCX translated [Bc.Bas] to [Bc.Cpp] for a C++ Compiler

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.0.4 Build 20241205
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

Compilation successful!

BCX BASIC to C/C++ Translator (c) 1999-2025 by Kevin Diggins
Version 8.2.6 (03/14/2025) Compiled using Intel C++ (2025.0.4) for 64-bit Windows
[Lines In: 38703] [Lines Out: 41980] [Statements: 34282] [Time: 0.92 Sec's]
BCX translated [Bc.Bas] to [Bc.Cpp] for a C++ Compiler

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.0.4 Build 20241205
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

Compilation successful!

BCX BASIC to C/C++ Translator (c) 1999-2025 by Kevin Diggins
Version 8.2.6 (03/14/2025) Compiled using Intel C++ (2025.0.4) for 64-bit Windows
[Lines In: 38703] [Lines Out: 41980] [Statements: 34282] [Time: 0.90 Sec's]
BCX translated [Bc.Bas] to [Bc.Cpp] for a C++ Compiler

Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.0.4 Build 20241205
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

Compilation successful!