Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinath Vadlamani committed Aug 6, 2018
1 parent 3783d06 commit 6481f11
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 46 deletions.
2 changes: 1 addition & 1 deletion codingTests/CMake/build-test/runCmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions codingTests/Mpi_stuff/omp_hello.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions codingTests/openmp/useFindMyCpuId.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
#include <sched.h>
#include <omp.h>

//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;
Expand Down
42 changes: 2 additions & 40 deletions neon/ifDefNeon.c
Original file line number Diff line number Diff line change
@@ -1,50 +1,12 @@
/* neon_example.c - Neon intrinsics example program */
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <arm_neon.h>
/* 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
Expand Down

0 comments on commit 6481f11

Please sign in to comment.