Visible to Intel only — GUID: GUID-00A9E90D-1397-4E65-94B6-D2DD840F67EF
Create a New Project
Use the Intel® oneAPI DPC++/C++ Compiler
Select the Compiler Version
Specify a Base Platform Toolset
Use Property Pages
Use Intel® Libraries with Microsoft Visual Studio*
Include MPI Support
Use Code Coverage in Microsoft Visual Studio*
Use Profile Guided Optimization in Microsoft Visual Studio*
Optimization Reports in Microsoft Visual Studio*
Dialog Box Help
Use Intel® oneAPI DPC++/C++ Compiler dialog box
Hardware Profile-Guided Optimization dialog box
Options: Compilers dialog box
Options: Intel Libraries for oneAPI dialog box
Options: Converter dialog box
Options: Optimization Reports dialog box
Options: Profile Guided Optimization dialog box
Profile Guided Optimization dialog box
Options: Code Coverage dialog box
Code Coverage dialog box
Code Coverage Settings dialog box
Alphabetical Option List
General Rules for Compiler Options
What Appears in the Compiler Option Descriptions
Optimization Options
Advanced Optimization Options
Code Generation Options
Offload Compilation, OpenMP*, and Parallel Processing Options
Interprocedural Optimization Options
Profile Guided Optimization Options
Optimization Report Options
Floating-Point Options
Inlining Options
Output, Debug, and Precompiled Header Options
Preprocessor Options
Component Control Options
Language Options
Data Options
Compiler Diagnostic Options
Compatibility Options
Linking or Linker Options
Miscellaneous Options
Deprecated and Removed Compiler Options
Display Option Information
Alternate Compiler Options
Portability and GCC-Compatible Warning Options
ffreestanding, Qfreestanding
fjump-tables
fvec-allow-scalar-stores, Qvec-allow-scalar-stores
fvec-peel-loops, Qvec-peel-loops
fvec-remainder-loops, Qvec-remainder-loops
fvec-with-mask, Qvec-with-mask
ipp-link, Qipp-link
mno-gather, Qgather-
mno-scatter, Qscatter-
qactypes, Qactypes
qdaal, Qdaal
qipp, Qipp
qmkl, Qmkl
qmkl-ilp64, Qmkl-ilp64
qmkl-sycl-impl, Qmkl-sycl-impl
qopt-assume-no-loop-carried-dep, Qopt-assume-no-loop-carried-dep
qopt-dword-index-for-array-of-structs, Qopt-dword-index-for-array-of-structs
qopt-dynamic-align, Qopt-dynamic-align
qopt-for-throughput, Qopt-for-throughput
qopt-mem-layout-trans, Qopt-mem-layout-trans
qopt-multiple-gather-scatter-by-shuffles, Qopt-multiple-gather-scatter-by-shuffles
qopt-prefetch, Qopt-prefetch
qopt-prefetch-distance, Qopt-prefetch-distance
qopt-prefetch-loads-only, Qopt-prefetch-loads-only
qopt-streaming-stores, Qopt-streaming-stores
qopt-zmm-usage, Qopt-zmm-usage
qtbb, Qtbb
unroll, Qunroll
vec, Qvec
vec-threshold, Qvec-threshold
vecabi, Qvecabi
arch
ax, Qax
EH
fasynchronous-unwind-tables
fcf-protection, Qcf-protection
fdata-sections, Gw
fexceptions
ffunction-sections, Gy
fomit-frame-pointer
Gd
GR
guard
Gv
m, Qm
m64, Qm64
m80387
march
masm
mauto-arch, Qauto-arch
mbranches-within-32B-boundaries, Qbranches-within-32B-boundaries
mintrinsic-promote, Qintrinsic-promote
momit-leaf-frame-pointer
mtune, tune
regcall, Qregcall
x, Qx
xHost, QxHost
device-math-lib
fintelfpga
fiopenmp, Qiopenmp
flink-huge-device-code
fno-sycl-libspirv
fopenmp
fopenmp-concurrent-host-device-compile, Qopenmp-concurrent-host-device-compile
fopenmp-declare-target-scalar-defaultmap, Qopenmp-declare-target-scalar-defaultmap
fopenmp-device-code-split, Qopenmp-device-code-split
fopenmp-device-lib
fopenmp-device-link, Qopenmp-device-link
fopenmp-max-parallel-link-jobs, Qopenmp-max-parallel-link-jobs
fopenmp-offload-mandatory, Qopenmp-offload-mandatory
fopenmp-target-buffers, Qopenmp-target-buffers
fopenmp-target-default-sub-group-size, Qopenmp-target-default-sub-group-size
fopenmp-target-loopopt, Qopenmp-target-loopopt
fopenmp-target-simd, Qopenmp-target-simd
fopenmp-targets, Qopenmp-targets
fsycl
fsycl-add-default-spec-consts-image
fsycl-allow-device-dependencies
fsycl-dead-args-optimization
fsycl-device-code-split
fsycl-device-lib
fsycl-device-obj
fsycl-device-only
fsycl-early-optimizations
fsycl-enable-function-pointers
fsycl-esimd-force-stateless-mem
fsycl-explicit-simd
fsycl-force-target
fsycl-fp64-conv-emu
fsycl-help
fsycl-host-compiler
fsycl-host-compiler-options
fsycl-id-queries-fit-in-int
fsycl-instrument-device-code
fsycl-link
fsycl-max-parallel-link-jobs
fsycl-optimize-non-user-code
fsycl-pstl-offload
fsycl-rdc
fsycl-remove-unused-external-funcs
fsycl-targets
fsycl-unnamed-lambda
fsycl-use-bitcode
ftarget-compile-fast
ftarget-export-symbols
ftarget-register-alloc-mode, Qtarget-register-alloc-mode
nolibsycl
qopenmp, Qopenmp
qopenmp-link
qopenmp-simd, Qopenmp-simd
qopenmp-stubs, Qopenmp-stubs
reuse-exe
Wno-sycl-strict
Xopenmp-target
Xs
Xsycl-target
ffp-accuracy, Qfp-accuracy
ffp-contract
fimf-absolute-error, Qimf-absolute-error
fimf-accuracy-bits, Qimf-accuracy-bits
fimf-arch-consistency, Qimf-arch-consistency
fimf-domain-exclusion, Qimf-domain-exclusion
fimf-max-error, Qimf-max-error
fimf-precision, Qimf-precision
fimf-use-svml, Qimf-use-svml
fma, Qfma
fp-model, fp
fp-speculation, Qfp-speculation
ftz, Qftz
pc, Qpc
w
W
Wabi
Wall
Wcheck-unicode-security
Wcomment
Wdeprecated
Werror, WX
Werror-all
Wextra-tokens
Wformat
Wformat-security
Wmain
Wmissing-declarations
Wmissing-prototypes
Wpointer-arith
Wreorder
Wreturn-type
Wshadow
Wsign-compare
Wstrict-aliasing
Wstrict-prototypes
Wtrigraphs
Wuninitialized
Wunknown-pragmas
Wunused-function
Wunused-variable
Wwrite-strings
Create Libraries
Use Intel Shared Libraries
Manage Libraries
Redistribute Libraries When Deploying Applications
Resolve References to Shared Libraries
Redistributable Library Considerations
Intel's Memory Allocator Library
SIMD Data Layout Templates
Intel® C++ Class Libraries
Intel's C++ Asynchronous I/O Extensions for Windows
IEEE 754-2008 Binary Floating-Point Conformance Library
Intel's Numeric String Conversion Library
Terms and Syntax
Rules for Operators
Assignment Operator
Logical Operators
Addition and Subtraction Operators
Multiplication Operators
Shift Operators
Comparison Operators
Conditional Select Operators
Debug Operations
Unpack Operators
Pack Operators
Clear MMX™ State Operator
Integer Functions for Intel® Streaming SIMD Extensions
Conversions between Fvec and Ivec
Fvec Syntax and Notation
Data Alignment
Conversions
Constructors and Initialization
Arithmetic Operators
Minimum and Maximum Operators
Logical Operators
Compare Operators
Conditional Select Operators for Fvec Classes
Cacheability Support Operators
Debug Operations
Load and Store Operators
Unpack Operators
Move Mask Operators
aio_read
aio_write
Example for aio_read and aio_write Functions
aio_suspend
Example for aio_suspend Function
aio_error
aio_return
Example for aio_error and aio_return Functions
aio_fsync
aio_cancel
Example for aio_cancel Function
lio_listio
Example for lio_listio Function
Asynchronous I/O Function Errors
Intel® IEEE 754-2008 Binary Floating-Point Conformance Library and Usage
Function List
Homogeneous General-Computational Operations Functions
General-Computational Operation Functions
Quiet-Computational Operations Functions
Signaling-Computational Operations Functions
Non-Computational Operations Functions
Compilation Overview
Supported Environment Variables
Pass Options to the Linker
Specify Alternate Tools
Use Configuration Files
Use Response Files
Global Symbols and Visibility Attributes for Linux*
Save Compiler Information in Your Executable
Link Debug Information
Ahead of Time Compilation
Device Offload Compilation Considerations
Use a Third-Party Compiler as a Host Compiler for SYCL Code
OpenMP* Support
SYCL* Support
Compiler Sanitizers
Intel® oneAPI Level Zero
Vectorization
Instrumented Profile-Guided Optimization
Hardware Profile-Guided Optimization
High-Level Optimization
Interprocedural Optimization
Methods to Optimize Code Size
Optimization Reports
Compiler Math Library
SYCL* Device Library
Simple Integer Math Functions
Basic Integer Arithmetic Operations
Simple Arithmetic Operations with Rounding Mode
Type Casting Functions for Floating-Point Numbers
Type Casting Functions for Half-Precision Types
Type Casting Functions for bfloat16 Type
Simple Half-Precision Arithmetic Math Functions
Half-Precision Comparison Functions
IMF Device Library Usage Example
IMF Device Library Function List
IMF Device Library Trigonometric Functions
IMF Device Library Hyperbolic Functions
IMF Device Library Exponential Functions
IMF Device Library Logarithmic Functions
IMF Device Library Power Functions
IMF Device Library Special Functions
IMF Device Library Rounding Functions
IMF Device Library Miscellaneous Functions
Visible to Intel only — GUID: GUID-00A9E90D-1397-4E65-94B6-D2DD840F67EF
IMF Device Library Usage Example
Intel Math Functions (IMF) Device Library power function calling example:
#include <sycl/ext/intel/math.hpp>
...
sycl::queue{}.submit([&](sycl::handler& h) { sycl::accessor out{a, h}; h.parallel_for(r, [=](sycl::item<1> idx) { out[idx] = sycl::ext::intel::math::pow(x, y); }); });
The pow.cpp example prompts you to enter two numbers, and then performs the power calculation using SYCL parallel computing.
The pow.cpp example:
/* file: pow.cpp */ /******************************************************************************* * Copyright 2024 Intel Corporation. * * This software and the related documents are Intel copyrighted materials, and * your use of them is governed by the express license under which they *were provided to you (License). Unless the License provides otherwise, you *may not use, modify, copy, publish, distribute, disclose or transmit this *software or the related documents without Intel's prior written permission. * * This software and the related documents are provided as is, with no *express or implied warranties, other than those that are expressly stated *in the License. *******************************************************************************/ #include <iostream> #include <sycl/ext/intel/math.hpp> #include <sycl/sycl.hpp> /** * Number of inputs */ constexpr int num = 1; /** * @brief Entry point of the program. * * This function calculates the power of two numbers using the SYCL framework. * It prompts user to enter two numbers, and then performs the power calculation * using SYCL parallel computing. The calculated results are printed to the console. * The expected result is also printed for comparison. * * @return 0 indicating successful execution of the program. */ int main() { float x, y; auto r = sycl::range{num}; sycl::buffer<float> a{r}; std::cout << "Enter x and y: "; std::cin >> x >> y; sycl::queue{}.submit([&](sycl::handler& h) { sycl::accessor out{a, h}; h.parallel_for(r, [=](sycl::item<1> idx) { out[idx] = sycl::ext::intel::math::pow(x, y); }); }); sycl::host_accessor result{a}; for (int i = 0; i < num; ++i) { std::cout << "Computed pow(" << x << ", " << y << ") = " << result[i] << "\n"; } std::cout << "Expected pow(" << x << ", " << y << ") = " << std::pow(x, y) << "\n"; return 0; }
The calculated results are printed to your console. The expected reference result is also printed for comparison. Use the makefile to compile and run the simple test using the SYCL compiler set up in environment with:
make exe make run make clean
A makefile example:
# file: makefile # ============================================================================== # Copyright (C) 2024 Intel Corporation. # # The information and source code contained herein is the exclusive property # of Intel Corporation and may not be disclosed, examined, or # reproduced in whole or in part without explicit written authorization from # the Company. # ============================================================================== default: all exe: pow.exe all: run SHELL := /bin/bash pow.exe: pow.cpp icx -fsycl ./pow.cpp -o ./pow.exe run: pow.exe ./pow.exe clean: @rm -f ./pow.exe
Parent topic: IMF Transcendental Math Functions