From 6481f11418cbcbcce9a3211f5d3e7b1ed8a9d7a8 Mon Sep 17 00:00:00 2001 From: Srinath Vadlamani Date: Mon, 6 Aug 2018 15:10:35 -0500 Subject: [PATCH] cleaned up --- codingTests/CMake/build-test/runCmake.sh | 2 +- codingTests/Mpi_stuff/omp_hello.f90 | 7 ++-- codingTests/openmp/useFindMyCpuId.c | 6 ++-- neon/ifDefNeon.c | 42 ++---------------------- 4 files changed, 11 insertions(+), 46 deletions(-) diff --git a/codingTests/CMake/build-test/runCmake.sh b/codingTests/CMake/build-test/runCmake.sh index 87bef74..3dfa095 100755 --- a/codingTests/CMake/build-test/runCmake.sh +++ b/codingTests/CMake/build-test/runCmake.sh @@ -4,7 +4,7 @@ if false ; then echo "if false" else rm -rf CMake* - cmake ../. + /home/srivad01/software/cmake/882ba7/gnu/7.2/bin/cmake ../. if [ $? ]; then echo "exit status is NOT 0 " else diff --git a/codingTests/Mpi_stuff/omp_hello.f90 b/codingTests/Mpi_stuff/omp_hello.f90 index a70aabd..9cfcd02 100644 --- a/codingTests/Mpi_stuff/omp_hello.f90 +++ b/codingTests/Mpi_stuff/omp_hello.f90 @@ -33,9 +33,10 @@ program hello np = omp_get_num_threads() iam = omp_get_thread_num() mycpu = findmycpu() - print "('hello_parallel.f: Number of tasks=',I3,' My rank=',I3,' My name=',A, & - ' total theads= ',I2, ' thread num=',I2, ' my cpu id=',I2,'')",& - numtasks, rank, trim(name), np, iam , mycpu +! print "('hello_parallel.f: Number of tasks=',I3,' My rank=',I3,' My name=',A, & +! ' total theads= ',I2, ' thread num=',I2, ' my cpu id=',I3,'')",& +! numtasks, rank, trim(name), np, iam , mycpu + write (*,*) mycpu !$omp end parallel ! Tell the MPI library to release all resources it is using: call MPI_FINALIZE(ierr) diff --git a/codingTests/openmp/useFindMyCpuId.c b/codingTests/openmp/useFindMyCpuId.c index 0f64f64..548e9a9 100644 --- a/codingTests/openmp/useFindMyCpuId.c +++ b/codingTests/openmp/useFindMyCpuId.c @@ -2,14 +2,16 @@ #include #include +//int findmycpu_ (); + int main() { #pragma omp parallel { int thread_num = omp_get_thread_num(); int cpu_num = sched_getcpu(); - int findmycpu_num = findmycpu_(); + // int findmycpu_num = findmycpu_(); printf("Thread %3d is running on CPU %3d\n", thread_num, cpu_num); - printf("Thread %3d is running on myCPU %3d\n", thread_num, findmycpu_num); + // printf("Thread %3d is running on myCPU %3d\n", thread_num, findmycpu_num); } return 0; diff --git a/neon/ifDefNeon.c b/neon/ifDefNeon.c index c33841b..4cbb1a2 100644 --- a/neon/ifDefNeon.c +++ b/neon/ifDefNeon.c @@ -1,50 +1,12 @@ /* neon_example.c - Neon intrinsics example program */ #include #include -#include #include -/* fill array with increasing integers beginning with 0 */ -void fill_array(int16_t *array, int size) -{ int i; - for (i = 0; i < size; i++) - { - array[i] = i; - } -} -/* return the sum of all elements in an array. This works by calculating 4 totals (one for each lane) and adding those at the end to get the final total */ -int sum_array(int16_t *array, int size) -{ - /* initialize the accumulator vector to zero */ - int16x4_t acc = vdup_n_s16(0); - int32x2_t acc1; - int64x1_t acc2; - /* this implementation assumes the size of the array is a multiple of 4 */ - assert((size % 4) == 0); - /* counting backwards gives better code */ - for (; size != 0; size -= 4) - { - int16x4_t vec; - /* load 4 values in parallel from the array */ - vec = vld1_s16(array); - /* increment the array pointer to the next element */ - array += 4; - /* add the vector to the accumulator vector */ - acc = vadd_s16(acc, vec); - } - /* calculate the total */ - acc1 = vpaddl_s16(acc); - acc2 = vpaddl_s32(acc1); - /* return the total as an integer */ - return (int)vget_lane_s64(acc2, 0); -} + /* main function */ int main() { -/* int16_t my_array[100]; - fill_array(my_array, 100); - printf("Sum was %d\n", sum_array(my_array, 100)); - return 0; -*/ + #ifdef __ARM_NEON printf("__ARM_NEON true \n"); #else