Browse Source

Enable SSE code only if sse support is available in the compiler

Samuel Thibault 14 years ago
parent
commit
f4b8145731

+ 6 - 1
examples/basic_examples/vector_scal.c

@@ -49,7 +49,12 @@ static starpu_codelet cl = {
 	.where = STARPU_CPU | STARPU_CUDA | STARPU_OPENCL,
 	/* CPU implementation of the codelet */
 	.cpu_func = STARPU_MULTIPLE_CPU_IMPLEMENTATIONS,
-	.cpu_funcs = { scal_cpu_func, scal_sse_func},
+	.cpu_funcs = {
+		scal_cpu_func
+#ifdef __SSE__
+		, scal_sse_func
+#endif
+	},
 #ifdef STARPU_USE_CUDA
 	/* CUDA implementation of the codelet */
 	.cuda_func = scal_cuda_func,

+ 2 - 0
examples/basic_examples/vector_scal_cpu.c

@@ -53,6 +53,7 @@ void scal_cpu_func(void *buffers[], void *cl_arg)
 		val[i] *= *factor;
 }
 
+#ifdef __SSE__
 void scal_sse_func(void *buffers[], void *cl_arg)
 {
 	float *vector = (float *) STARPU_VECTOR_GET_PTR(buffers[0]);
@@ -69,3 +70,4 @@ void scal_sse_func(void *buffers[], void *cl_arg)
 	for (i = 0; i < n_iterations; i++)
 		VECTOR[i] = _mm_mul_ps(factor, VECTOR[i]);
 }
+#endif