Hello,
the compiler tells me to contact Intel ;-) I'm a beginner to MIC programming and having a hard time teaching the offload mechanism to accept C++ complex numbers.
[l_stadler_h@merlinx01 complex-test]$ icpc --version
icpc (ICC) 15.0.2 20150121
Copyright (C) 1985-2015 Intel Corporation. All rights reserved.
[l_stadler_h@merlinx01 complex-test]$ icpc -std=c++11 complex-test.cc
": internal error: ** The compiler has encountered an unexpected problem.
** Segmentation violation signal raised. **
Access violation or stack overflow. Please contact Intel Support for assistance.
compilation aborted for complex-test.cc (code 4)
[l_stadler_h@merlinx01 complex-test]$ cat complex-test.cc
#include <iostream>
#pragma offload_attribute(push, _Cilk_shared)
#include <complex>
#pragma offload_attribute(pop)
namespace {
using std::complex;
_Cilk_shared complex<float> r;
_Cilk_shared void product (_Cilk_shared complex<float> &result, _Cilk_shared complex<float> *a, _Cilk_shared complex<float> *b, unsigned int sz)
{
using std::conj;
complex<float> res = complex<float>(.0f, .0f);
_Cilk_for (unsigned int i=0; i<sz; i++) {
complex<float> c(b[i].real(), -b[i].imag()), d(a[i].real(), a[i].imag());
res += d * c;
}
result = res;
}
}
int main (int argc, char *argv[])
{
using std::cout;
constexpr unsigned int sz = 10000;
_Cilk_shared complex<float> *a = (_Cilk_shared complex<float> *)_Offload_shared_aligned_malloc(sz * sizeof(*a), 64);
_Cilk_for (unsigned int i=0; i<sz; i++)
a[i] = complex<float>(1.f/float(i), 1.f/float(i));
_Cilk_offload product(r, a, a, sz);
_Offload_shared_aligned_free(a);
float real = r.real();
float imag = r.imag();
complex<float> res(real, imag);
cout << "Result = "<< res << '\n';
return 0;
}
-----------------------------
micinfo:
MicInfo Utility Log
Created Thu Feb 19 16:41:41 2015
System Info
HOST OS : Linux
OS Version : 3.10.0-123.20.1.el7.x86_64
Driver Version : 3.4.2-1
MPSS Version : 3.4.2
Host Physical Memory : 131753 MB
Device No: 0, Device Name: mic0
Version
Flash Version : 2.1.02.0390
SMC Firmware Version : 1.16.5078
SMC Boot Loader Version : 1.8.4326
uOS Version : 2.6.38.8+mpss3.4.2
Device Serial Number : ADKC43600092
Board
Vendor ID : 0x8086
Device ID : 0x225c
Subsystem ID : 0x7d95
Coprocessor Stepping ID : 2
PCIe Width : Insufficient Privileges
PCIe Speed : Insufficient Privileges
PCIe Max payload size : Insufficient Privileges
PCIe Max read req size : Insufficient Privileges
Coprocessor Model : 0x01
Coprocessor Model Ext : 0x00
Coprocessor Type : 0x00
Coprocessor Family : 0x0b
Coprocessor Family Ext : 0x00
Coprocessor Stepping : C0
Board SKU : C0PRQ-7120 P/A/X/D
ECC Mode : Enabled
SMC HW Revision : Product 300W Passive CS
Cores
Total No of Active Cores : 61
Voltage : 950000 uV
Frequency : 1238095 kHz
Thermal
Fan Speed Control : N/A
Fan RPM : N/A
Fan PWM : N/A
Die Temp : 41 C
GDDR
GDDR Vendor : Samsung
GDDR Version : 0x6
GDDR Density : 4096 Mb
GDDR Size : 15872 MB
GDDR Technology : GDDR5
GDDR Speed : 5.500000 GT/s
GDDR Frequency : 2750000 kHz
GDDR Voltage : 1501000 uV
Device No: 1, Device Name: mic1
Version
Flash Version : 2.1.02.0390
SMC Firmware Version : 1.16.5078
SMC Boot Loader Version : 1.8.4326
uOS Version : 2.6.38.8+mpss3.4.2
Device Serial Number : ADKC43600046
Board
Vendor ID : 0x8086
Device ID : 0x225c
Subsystem ID : 0x7d95
Coprocessor Stepping ID : 2
PCIe Width : Insufficient Privileges
PCIe Speed : Insufficient Privileges
PCIe Max payload size : Insufficient Privileges
PCIe Max read req size : Insufficient Privileges
Coprocessor Model : 0x01
Coprocessor Model Ext : 0x00
Coprocessor Type : 0x00
Coprocessor Family : 0x0b
Coprocessor Family Ext : 0x00
Coprocessor Stepping : C0
Board SKU : C0PRQ-7120 P/A/X/D
ECC Mode : Enabled
SMC HW Revision : Product 300W Passive CS
Cores
Total No of Active Cores : 61
Voltage : 1001000 uV
Frequency : 1238095 kHz
Thermal
Fan Speed Control : N/A
Fan RPM : N/A
Fan PWM : N/A
Die Temp : 43 C
GDDR
GDDR Vendor : Samsung
GDDR Version : 0x6
GDDR Density : 4096 Mb
GDDR Size : 15872 MB
GDDR Technology : GDDR5
GDDR Speed : 5.500000 GT/s
GDDR Frequency : 2750000 kHz
GDDR Voltage : 1501000 uV
[l_stadler_h@merlinx01 complex-test]$ lsb_release -d
Description: CentOS Linux release 7.0.1406 (Core) (Maipo)
So, any hints on how C++ complex numbers and arrays of these are tranferred easily from host to mic and back?