Skip to content

Commit de9949f

Browse files
committed
Updated POD, renamed function
Renamed PerlOMP_VERIFY_1D_CHAR_ARRAY to PerlOMP_VERIFY_1D_STRING_ARRAY.
1 parent e625deb commit de9949f

File tree

4 files changed

+45
-56
lines changed

4 files changed

+45
-56
lines changed

Changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,8 @@
8686
- updated documentation
8787
- added Github initial CI testing for latest Ubuntu,
8888
- added VERIFY C functions (see POD)
89+
90+
0.2.1 03/05/2025 11:08:00 PM MST
91+
- updated POD
92+
- renamed, "PerlOMP_VERIFY_1D_CHAR_ARRAY" to
93+
"PerlOMP_VERIFY_1D_STRING_ARRAY" for consistency

lib/OpenMP/Simple.pm

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use strict;
44
use warnings;
55
use Alien::OpenMP;
66

7-
our $VERSION = q{0.2.0};
7+
our $VERSION = q{0.2.1};
88

99
# This module is a wrapper around a ".h" file that is injected into Alien::OpenMP
1010
# via Inline:C's AUTO_INCLUDE feature. This header file constains C MACROs for reading
@@ -113,9 +113,7 @@ All MACROS have at least 1 test in the suite. Please look at these in the
113113
Github repository to get an idea of how to use C<OpenMP::Simple>'s macros
114114
with C<OpenMP::Environment>.
115115
116-
=over 4
117-
118-
=item C<PerlOMP_GETENV_BASIC>
116+
=head3 C<PerlOMP_GETENV_BASIC>
119117
120118
Equivalent of using,
121119
@@ -126,225 +124,211 @@ The purpose of this bundled approach is to make it easier to get started
126124
quickly. This list may be updated between versions. This is the recommended
127125
one to use when starting with this module. See the L<SYNOPSIS> example.
128126
129-
=item C<PerlOMP_UPDATE_WITH_ENV__NUM_THREADS>
127+
=head3 C<PerlOMP_UPDATE_WITH_ENV__NUM_THREADS>
130128
131129
Updates the OpenMP runtime with the value of the environmental
132130
variable, C<$ENV{OMP_NUM_THREADS}>, which is managed via
133131
C<< OpenMP::Environment->omp_num_threads[int numThreads]); >>.
134132
135-
=item C<PerlOMP_UPDATE_WITH_ENV__DEFAULT_DEVICE>
133+
=head3 C<PerlOMP_UPDATE_WITH_ENV__DEFAULT_DEVICE>
136134
137135
Updates the OpenMP runtime with the value of the environmental
138136
variable, C<$ENV{OMP_DEFAULT_DEVICE}>, which is managed
139137
via C<< OpenMP::Environment->omp_default_device([int deviceNo]); >>.
140138
141-
=item C<PerlOMP_UPDATE_WITH_ENV__MAX_ACTIVE_LEVELS>
139+
=head3 C<PerlOMP_UPDATE_WITH_ENV__MAX_ACTIVE_LEVELS>
142140
143141
Updates the OpenMP runtime with the value of the environmental
144142
variable, C<$ENV{OMP_MAX_ACTIVE_LEVELS}>, which is managed
145143
via C<< OpenMP::Environment->omp_max_active_levels([int maxLevel]); >>.
146144
147-
=item C<PerlOMP_UPDATE_WITH_ENV__DYNAMIC>
145+
=head3 C<PerlOMP_UPDATE_WITH_ENV__DYNAMIC>
148146
149147
Updates the OpenMP runtime with the value of the environmental
150148
variable, C<$ENV{OMP_DYNAMIC}>, which is managed
151149
via C<< OpenMP::Environment->omp_dynamic(['true'|'false']); >>.
152150
153-
=item C<PerlOMP_UPDATE_WITH_ENV__NESTED>
151+
=head3 C<PerlOMP_UPDATE_WITH_ENV__NESTED>
154152
155153
Updates the OpenMP runtime with the value of the environmental
156154
variable, C<$ENV{OMP_NESTED}>, which is managed
157155
via C<< OpenMP::Environment->omp_nested(['true'|'false']); >>.
158156
159-
=item C<PerlOMP_UPDATE_WITH_ENV__SCHEDULE>
157+
=head3 C<PerlOMP_UPDATE_WITH_ENV__SCHEDULE>
160158
161159
Updates the OpenMP runtime with the value of the environmental
162160
variable, C<$ENV{OMP_SCHEDULE}>, which is managed
163161
via C<< OpenMP::Environment->omp_schedule(...); >>.
164162
165163
Note: The schedule syntax is of the form I<schedule[;chunkSize]>.
166164
167-
=item C<PerlOMP_UPDATE_WITH_ENV__TEAMS_THREAD_LIMIT>
165+
=head3 C<PerlOMP_UPDATE_WITH_ENV__TEAMS_THREAD_LIMIT>
168166
169167
Updates the OpenMP runtime with the value of the environmental
170168
variable, C<$ENV{OMP_TEAMS_THREAD_LIMIT}>, which is managed via C<< OpenMP::Environment->omp_([int limit]); >>.
171169
172170
Note: C<OMP_TEAMS_THREAD_LIMIT> is not supported until GCC 12.3.0
173171
174-
=item C<PerlOMP_UPDATE_WITH_ENV__NUM_TEAMS>
172+
=head3 C<PerlOMP_UPDATE_WITH_ENV__NUM_TEAMS>
175173
176174
Updates the OpenMP runtime with the value of the environmental variable,
177175
C<$ENV{OMP_NUM_TEAMS}>, which is managed via C<< OpenMP::Environment->omp_([int num]); >>.
178176
179177
Note: C<OMP_NUM_TEAMS> is not supported until GCC 12.3.0
180178
181-
=item C<PerlOMP_RET_ARRAY_REF_ret>
179+
=head3 C<PerlOMP_RET_ARRAY_REF_ret>
182180
183181
(may not be needed) - creates a new C<AV*> and sets it I<mortal> (doesn't
184182
survive outside of the current scope). Used when wanting to return an array
185183
reference that's been populated via C<av_push>.
186184
187-
=back
188-
189185
=head1 PROVIDED PERL ARRAY COUNTING FUNCTIONS
190186
191-
=over 4
192-
193-
=item C<int PerlOMP_1D_Array_NUM_ELEMENTS (SV *AVref)>
187+
=head2 C<int PerlOMP_1D_Array_NUM_ELEMENTS (SV *AVref)>
194188
195189
Returns the integer count of number of elements in the array reference. The
196190
functino doesn't care what is in the elements.
197191
198-
=item C<int PerlOMP_2D_AoA_NUM_ROWS(SV *AoAref)>
192+
=head2 C<int PerlOMP_2D_AoA_NUM_ROWS(SV *AoAref)>
199193
200194
Returns the integer count of number of rows in a 2D array reference. The
201195
fucntion doesn't care what the rows looks like or what is in them
202196
203-
=item C<int PerlOMP_2D_AoA_NUM_COLS(SV *AoAref)>
197+
=head2 C<int PerlOMP_2D_AoA_NUM_COLS(SV *AoAref)>
204198
205199
Returns the number of elements in the first row of the provided 2D array
206200
reference. It assumes all rows are the same. It doesn't verify the contents
207201
of each row.
208202
209-
=back
210-
211203
=head1 PROVIDED PERL TO C CONVERSION FUNCTIONS
212204
213205
B<Note>: Work is currently focused on finding the true limits of the Perl C
214206
API. It is likely that in a lot of cases, elements in Perl Arrays (AV) and Perl
215207
Hashes (HV) maybe accessed safely without first transferring the entire data
216208
structures into its pure C<C> equivalent.
217209
218-
=over 4
219-
220-
=item C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY>
210+
=head2 C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY>
221211
222212
void PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY(SV *AVref, int numElements, float retArray[numElements]);
223213
224214
Converts a 1D Perl Array Reference (C<AV*>) into a 1D C array of floats. This function assumes the Perl array contains numeric floating point values.
225215
226-
=item C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY_r>
216+
=head2 C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY_r>
227217
228218
void PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY_r(SV *AVref, int numElements, float retArray[numElements]);
229219
230220
The parallelized version of C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
231221
232-
=item C<PerlOMP_1D_Array_TO_1D_INT_ARRAY>
222+
=head2 C<PerlOMP_1D_Array_TO_1D_INT_ARRAY>
233223
234224
void PerlOMP_1D_Array_TO_1D_INT_ARRAY(SV *AVref, int numElements, int retArray[numElements]);
235225
236226
Converts a 1D Perl Array Reference (C<AV*>) into a 1D C array of integers. This function assumes the Perl array contains integer values.
237227
238-
=item C<PerlOMP_1D_Array_TO_1D_INT_ARRAY_r>
228+
=head2 C<PerlOMP_1D_Array_TO_1D_INT_ARRAY_r>
239229
240230
void PerlOMP_1D_Array_TO_1D_INT_ARRAY_r(SV *AVref, int numElements, int retArray[numElements]);
241231
242232
The parallelized version of C<PerlOMP_1D_Array_TO_1D_INT_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
243233
244-
=item C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY>
234+
=head2 C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY>
245235
246236
void PerlOMP_1D_Array_TO_1D_STRING_ARRAY(SV *AVref, int numElements, char *retArray[numElements]);
247237
248238
Converts a 1D Perl Array Reference (C<AV*>) into a 1D C array of strings. The Perl array should contain string values.
249239
250-
=item C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r>
240+
=head2 C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r>
251241
252242
void PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r(SV *AVref, int numElements, char *retArray[numElements]);
253243
254244
The parallelized version of C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
255245
256-
=item C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY>
246+
=head2 C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY>
257247
258248
void PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY(SV *AoA, int numRows, int rowSize, float retArray[numRows][rowSize]);
259249
260250
Converts a 2D Array of Arrays (AoA) in Perl into a 2D C array of floats. The Perl array should be an array of arrays, where each inner array contains floating point values.
261251
262-
=item C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY_r>
252+
=head2 C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY_r>
263253
264254
void PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY_r(SV *AoA, int numRows, int rowSize, float retArray[numRows][rowSize]);
265255
266256
The parallelized version of C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
267257
268-
=item C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY>
258+
=head2 C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY>
269259
270260
void PerlOMP_2D_AoA_TO_2D_INT_ARRAY(SV *AoA, int numRows, int rowSize, int retArray[numRows][rowSize]);
271261
272262
Converts a 2D Array of Arrays (AoA) in Perl into a 2D C array of integers. The Perl array should be an array of arrays, where each inner array contains integer values.
273263
274-
=item C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY_r>
264+
=head2 C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY_r>
275265
276266
void PerlOMP_2D_AoA_TO_2D_INT_ARRAY_r(SV *AoA, int numRows, int rowSize, int retArray[numRows][rowSize]);
277267
278268
The parallelized version of C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
279269
280-
=item C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY>
270+
=head2 C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY>
281271
282272
void PerlOMP_2D_AoA_TO_2D_STRING_ARRAY(SV *AoA, int numRows, int rowSize, char *retArray[numRows][rowSize]);
283273
284274
Converts a 2D Array of Arrays (AoA) in Perl into a 2D C array of strings. The Perl array should be an array of arrays, where each inner array contains string values.
285275
286-
=item C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY_r>
276+
=head2 C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY_r>
287277
288278
void PerlOMP_2D_AoA_TO_2D_STRING_ARRAY_r(SV *AoA, int numRows, int rowSize, char *retArray[numRows][rowSize]);
289279
290280
The parallelized version of C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY> using OpenMP. This function performs the same operation, but the array conversion is parallelized with OpenMP.
291281
292-
=back
293-
294282
=head1 PROVIDED ARRAY MEMBER VERIFICATION FUNCTIONS
295283
296-
=over 4
297-
298-
=item C<PerlOMP_VERIFY_1D_Array>
284+
=head2 C<PerlOMP_VERIFY_1D_Array>
299285
300286
void PerlOMP_VERIFY_1D_Array(SV* array);
301287
302288
Verifies that the given Perl variable is a valid 1D array reference.
303289
304-
=item C<PerlOMP_VERIFY_1D_INT_ARRAY>
290+
=head2 C<PerlOMP_VERIFY_1D_INT_ARRAY>
305291
306292
void PerlOMP_VERIFY_1D_INT_ARRAY(SV* array);
307293
308294
Verifies that the given 1D array contains only integer values.
309295
310-
=item C<PerlOMP_VERIFY_1D_FLOAT_ARRAY>
296+
=head2 C<PerlOMP_VERIFY_1D_FLOAT_ARRAY>
311297
312298
void PerlOMP_VERIFY_1D_FLOAT_ARRAY(SV* array);
313299
314300
Verifies that the given 1D array contains only floating-point values.
315301
316-
=item C<PerlOMP_VERIFY_1D_CHAR_ARRAY>
302+
=head2 C<PerlOMP_VERIFY_1D_CHAR_ARRAY>
317303
318304
void PerlOMP_VERIFY_1D_CHAR_ARRAY(SV* array);
319305
320306
Verifies that the given 1D array contains only string values.
321307
322-
=item C<PerlOMP_VERIFY_2D_AoA>
308+
=head2 C<PerlOMP_VERIFY_2D_AoA>
323309
324310
void PerlOMP_VERIFY_2D_AoA(SV* array);
325311
326312
Verifies that the given Perl variable is a valid 2D array of arrays (AoA) reference.
327313
328-
=item C<PerlOMP_VERIFY_2D_INT_ARRAY>
314+
=head2 C<PerlOMP_VERIFY_2D_INT_ARRAY>
329315
330316
void PerlOMP_VERIFY_2D_INT_ARRAY(SV* array);
331317
332318
Verifies that the given 2D array contains only integer values.
333319
334-
=item C<PerlOMP_VERIFY_2D_FLOAT_ARRAY>
320+
=head2 C<PerlOMP_VERIFY_2D_FLOAT_ARRAY>
335321
336322
void PerlOMP_VERIFY_2D_FLOAT_ARRAY(SV* array);
337323
338324
Verifies that the given 2D array contains only floating-point values.
339325
340-
=item C<PerlOMP_VERIFY_2D_STRING_ARRAY>
326+
=head2 C<PerlOMP_VERIFY_2D_STRING_ARRAY>
341327
342328
void PerlOMP_VERIFY_2D_STRING_ARRAY(SV* array);
343329
344330
Verifies that the given 2D array contains only string values.
345331
346-
=back
347-
348332
=head1 SEE ALSO
349333
350334
This is a module that aims at making it easier to bootstrap Perl+OpenMP

share/openmp-simple.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ void verify_1D_array_type(SV *array, bool (*type_check)(SV *), const char *type_
478478
void PerlOMP_VERIFY_1D_FLOAT_ARRAY(SV *array) { verify_1D_array_type(array, is_float, "float"); }
479479
void PerlOMP_VERIFY_1D_INT_ARRAY(SV *array) { verify_1D_array_type(array, is_int, "integer"); }
480480
void PerlOMP_VERIFY_1D_DOUBLE_ARRAY(SV *array) { verify_1D_array_type(array, is_float, "double"); }
481-
void PerlOMP_VERIFY_1D_CHAR_ARRAY(SV *array) { verify_1D_array_type(array, is_string, "string"); }
481+
void PerlOMP_VERIFY_1D_STRING_ARRAY(SV *array) { verify_1D_array_type(array, is_string, "string"); }
482482

483483
/* Check for mixed types */
484484
void PerlOMP_VERIFY_1D_MIXED_ARRAY(SV *array) {

t/00-PerlOMP_VERIFY.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ use Test::Exception;
1212

1313
my $valid_1d_int = [1, 2, 3, 4, 5];
1414
my $valid_1d_float = [1.1, 2.2, 3.3, 4.4, 5.5];
15-
my $valid_1d_string = ["a", "b", "c", "d"];
15+
my $valid_1d_string = ["ant", "bat", "cat", "dog"];
1616

1717
my $valid_2d_int = [[1, 2], [3, 4], [5, 6]];
1818
my $valid_2d_float = [[1.1, 2.2], [3.3, 4.4], [5.5, 6.6]];
19-
my $valid_2d_string = [["a", "b"], ["c", "d"], ["e", "f"]];
19+
my $valid_2d_string = [["ark", "bar"], ["car", "day"], ["egg", "fly"]];
2020

2121
my $invalid_scalar = 42;
2222
my $invalid_1d_array = { key => "value" };
@@ -31,8 +31,8 @@ dies_ok { _PerlOMP_VERIFY_1D_INT_ARRAY($valid_1d_float) } "Float 1D array should
3131
lives_ok { _PerlOMP_VERIFY_1D_FLOAT_ARRAY($valid_1d_float) } "Valid 1D float array";
3232
dies_ok { _PerlOMP_VERIFY_1D_FLOAT_ARRAY($valid_1d_int) } "Int 1D array should fail float verification";
3333

34-
lives_ok { _PerlOMP_VERIFY_1D_CHAR_ARRAY($valid_1d_string) } "Valid 1D string array";
35-
dies_ok { _PerlOMP_VERIFY_1D_CHAR_ARRAY($valid_1d_int) } "Int 1D array should fail string verification";
34+
lives_ok { _PerlOMP_VERIFY_1D_STRING_ARRAY($valid_1d_string) } "Valid 1D string array";
35+
dies_ok { _PerlOMP_VERIFY_1D_STRING_ARRAY($valid_1d_int) } "Int 1D array should fail string verification";
3636

3737
# Verify 2D arrays
3838
dies_ok { _PerlOMP_VERIFY_2D_AoA($invalid_scalar) } "Scalar should not be a valid 2D array";
@@ -55,7 +55,7 @@ __C__
5555
void _PerlOMP_VERIFY_1D_Array(SV* array) { PerlOMP_VERIFY_1D_Array(array); }
5656
void _PerlOMP_VERIFY_1D_INT_ARRAY(SV* array) { PerlOMP_VERIFY_1D_INT_ARRAY(array); }
5757
void _PerlOMP_VERIFY_1D_FLOAT_ARRAY(SV* array) { PerlOMP_VERIFY_1D_FLOAT_ARRAY(array); }
58-
void _PerlOMP_VERIFY_1D_CHAR_ARRAY(SV* array) { PerlOMP_VERIFY_1D_CHAR_ARRAY(array); }
58+
void _PerlOMP_VERIFY_1D_STRING_ARRAY(SV* array) { PerlOMP_VERIFY_1D_STRING_ARRAY(array); }
5959
void _PerlOMP_VERIFY_2D_AoA(SV* array) { PerlOMP_VERIFY_2D_AoA(array); }
6060
void _PerlOMP_VERIFY_2D_INT_ARRAY(SV* array) { PerlOMP_VERIFY_2D_INT_ARRAY(array); }
6161
void _PerlOMP_VERIFY_2D_FLOAT_ARRAY(SV* array) { PerlOMP_VERIFY_2D_FLOAT_ARRAY(array); }

0 commit comments

Comments
 (0)