3 ms·
#pragma openmp simd for(int i=0; i<1000; i++){ z[i] = x[i] + y[i]; // Look ma, I'm parallel! } Relies very heavily on the autovectorizer of GCC
by dragontamer 2y ago
#pragma openmp simd
for(int i=0; i<1000; i++){
z[i] = x[i] + y[i]; // Look ma, I'm parallel!
}
Relies very heavily on the autovectorizer of GCC / LLVM, but it works somewhat well if you know what you're doing. Also, I'm pretty sure #pragma openmp simd doesn't actually do anything but maybe makes the "failed to vectorize" warnings a bit more obvious??
I dunno, I don't play with the auto-vectorizer that much actually.