openshmem-org / tests-sos

Sandia OpenSHMEM unit tests and performance testing suite
Other
6 stars 11 forks source link

Cleanup SOS Tests #44

Open markbrown314 opened 3 months ago

markbrown314 commented 3 months ago
  1. There are some cases in the code base where memory allocations _shmemmalloc() returns are not checked for NULL results. That should be fixed.

e.g.

web.c:174:    channels = shmem_malloc(n_threads*sizeof(channel));
web.c-175-    memset(channels,0,n_threads*sizeof(channel));
web.c-176-

spam.c:452:    pSync = (long*) shmem_malloc( 2 * sizeof(long) * SHMEM_COLLECT_SYNC_SIZE );
spam.c-453-    pSync1 = &pSync[SHMEM_COLLECT_SYNC_SIZE];

shmem_team_ptr.c:85:    shr_heap = shmem_malloc(sizeof(int));
shmem_team_ptr.c-86-    *shr_heap = me;
  1. Deprecated tests are interleaved with active tests and separated through conditional compilation. These deprecated tests should be moved to their own C files and then be compiled with the build system rather than using conditional compilation within the same file. It would improve readability at the cost of code duplication.

e.g.

119:#ifdef ENABLE_DEPRECATED_TESTS
120-    shmem_int_and_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
121-#else
122-    shmem_uint_and_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
123-#endif
124-    shmem_barrier_all();
125:#ifdef ENABLE_DEPRECATED_TESTS
126-    shmem_int_or_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
127-#else
128-    shmem_uint_or_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
129-#endif
130-    shmem_barrier_all();
131:#ifdef ENABLE_DEPRECATED_TESTS
132-    shmem_int_xor_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
133-#else
134-    shmem_uint_xor_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
135-#endif
136-    shmem_barrier_all();
137:#ifdef ENABLE_DEPRECATED_TESTS
138-    shmem_int_min_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
139-#else
140-    shmem_int_min_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
141-#endif
142-    shmem_barrier_all();
143:#ifdef ENABLE_DEPRECATED_TESTS
144-    shmem_int_max_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
145-#else
146-    shmem_int_max_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
147-#endif
148-    shmem_barrier_all();
149:#ifdef ENABLE_DEPRECATED_TESTS
150-    shmem_int_sum_to_all(NULL, NULL, 0, 0, 0, npes, pwrk, reduce_psync);
151-#else
152-    shmem_int_sum_reduce(SHMEM_TEAM_WORLD, NULL, NULL, 0);
153-#endif

I might add some more items to this list as I come across them.