Antti-Pekka Hynninen
Joined: 17 Aug 2012 Posts: 1
|
Posted: Fri Aug 17, 2012 9:40 am Post subject: Segfault on SSE intrinsic code |
|
|
Hi, the following very simple code segfaults in the kraken supercomputer. Compiled with:
"pgcc sse_test.c"
pgcc version:
pgcc 11.9-0 64-bit target on x86-64 Linux -tp k8e
sse_test.c:
--------------------
#include <stdio.h>
#include <math.h>
#ifdef __SSE2__
#include <emmintrin.h>
#endif
#if defined(__INTEL_COMPILER) && !defined(__SSE3__)
#define __SSE3__
#endif
#ifdef __SSE3__
#include <pmmintrin.h>
#endif
/*
Only difference between test_crash and test_ok is the location of the input parameter q1
*/
void test_crash(__m128d dx2, __m128d dy2, __m128d dz2, __m128d rsq2,
__m128d dx3, __m128d dy3, __m128d dz3, __m128d rsq3,
double *pftable,
double *forcexjj0, double *forceyjj0, double *forcezjj0,
double *forcexjj1, double *forceyjj1, double *forcezjj1,
__m128d q1
) {
printf("test_crash, Here (1)\n");
__m128d ep1 = _mm_set1_pd(1.0);
printf("test_crash, Here (2)\n");
__m128d coulpotd = _mm_mul_pd(q1, ep1);
printf("test_crash, Here (3)\n");
return;
}
void test_ok(__m128d dx2, __m128d dy2, __m128d dz2, __m128d rsq2,
__m128d dx3, __m128d dy3, __m128d dz3, __m128d rsq3,
double *pftable,
double *forcexjj0, double *forceyjj0, double *forcezjj0,
__m128d q1,
double *forcexjj1, double *forceyjj1, double *forcezjj1
) {
printf("test_ok, Here (1)\n");
__m128d ep1 = _mm_set1_pd(1.0);
printf("test_ok, Here (2)\n");
__m128d coulpotd = _mm_mul_pd(q1, ep1);
printf("test_ok, Here (3)\n");
return;
}
int main() {
double forcex;
double pftable;
__m128d dx2 = _mm_set1_pd(0.0);
__m128d dy2 = _mm_set1_pd(0.0);
__m128d dz2 = _mm_set1_pd(0.0);
__m128d rsq2 = _mm_set1_pd(0.0);
__m128d dx3 = _mm_set1_pd(0.0);
__m128d dy3 = _mm_set1_pd(0.0);
__m128d dz3 = _mm_set1_pd(0.0);
__m128d rsq3 = _mm_set1_pd(0.0);
__m128d qOOd = _mm_set1_pd(0.0);
test_ok(dx2, dy2, dz2, rsq2,
dx3, dy3, dz3, rsq3,
&pftable,
&forcex, &forcex, &forcex,
qOOd,
&forcex, &forcex, &forcex
);
test_crash(dx2, dy2, dz2, rsq2,
dx3, dy3, dz3, rsq3,
&pftable,
&forcex, &forcex, &forcex,
&forcex, &forcex, &forcex,
qOOd
);
return 1;
}
---------------- |
|