Skip to content

Commit 730710c

Browse files
committed
Implemented some conversion functions in case they are helpful for non-Perl folks just getting into this
Resolves #8. Resolves #7 (PR).
1 parent d982c81 commit 730710c

16 files changed

+9
-991
lines changed

.github/workflows/perl-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
# ---- Install Author Dependencies ----
3131
- name: Install dzil authordeps
3232
run: |
33-
dzil authordeps --missing | sudo cpanm --verbose # Install required author dependencies
34-
sudo cpanm --verbose Dist::Zilla::Plugin::VersionFromModule
33+
dzil authordeps --missing | sudo cpanm --verbose # Install required author dependencies
34+
sudo cpanm --verbose Dist::Zilla::Plugin::VersionFromModule # this may be redundant
3535
3636
# ---- Run `dzil test` ----
3737
- name: Run `dzil test`

Change

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,5 @@
7777
- int PerlOMP_1D_Array_NUM_ELEMENTS (SV *AVref)
7878
- int PerlOMP_2D_AoA_NUM_ROWS(SV *AoAref)
7979
- int PerlOMP_2D_AoA_NUM_COLS(SV *AoAref)
80-
- void PerlOMP_1D_Array_TO_1D_STRING_ARRAY(SV *AVref, int numElements, char *retArray[numElements])
81-
- void PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r(SV *AVref, int numElements, char *retArray[numElements])
82-
- added Github initial CI testing
83-
- started documentation
8480
- added Github initial CI testing for latest Ubuntu,
85-
- added VERIFY C functions
81+
Rocky Linux

dist.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ OpenMP::Environment = 0
1818
Util::H2O::More = >= 0.3.4
1919
Test::More = 0
2020
Test::Exception = 0
21-
Test::Deep = 0
2221
Digest::MD5 = 0
2322
File::Temp = 0
2423
[Prereqs]

lib/OpenMP/Simple.pm

Lines changed: 6 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,7 @@ reference that's been populated via C<av_push>.
186186
187187
=back
188188
189-
=head1 PROVIDED PERL ARRAY COUNTING FUNCTIONS
190-
191-
=over 4
189+
=head PROVIDED PERL ARRAY COUNTING FUNCTIONS
192190
193191
=item C<int PerlOMP_1D_Array_NUM_ELEMENTS (SV *AVref)>
194192
@@ -206,8 +204,6 @@ Returns the number of elements in the first row of the provided 2D array
206204
reference. It assumes all rows are the same. It doesn't verify the contents
207205
of each row.
208206
209-
=back
210-
211207
=head1 PROVIDED PERL TO C CONVERSION FUNCTIONS
212208
213209
B<Note>: Work is currently focused on finding the true limits of the Perl C
@@ -217,131 +213,13 @@ structures into its pure C<C> equivalent.
217213
218214
=over 4
219215
220-
=item C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY>
221-
222-
void PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY(SV *AVref, int numElements, float retArray[numElements]);
223-
224-
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.
225-
226-
=item C<PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY_r>
227-
228-
void PerlOMP_1D_Array_TO_1D_FLOAT_ARRAY_r(SV *AVref, int numElements, float retArray[numElements]);
229-
230-
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.
231-
232-
=item C<PerlOMP_1D_Array_TO_1D_INT_ARRAY>
233-
234-
void PerlOMP_1D_Array_TO_1D_INT_ARRAY(SV *AVref, int numElements, int retArray[numElements]);
235-
236-
Converts a 1D Perl Array Reference (C<AV*>) into a 1D C array of integers. This function assumes the Perl array contains integer values.
237-
238-
=item C<PerlOMP_1D_Array_TO_1D_INT_ARRAY_r>
239-
240-
void PerlOMP_1D_Array_TO_1D_INT_ARRAY_r(SV *AVref, int numElements, int retArray[numElements]);
241-
242-
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.
243-
244-
=item C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY>
245-
246-
void PerlOMP_1D_Array_TO_1D_STRING_ARRAY(SV *AVref, int numElements, char *retArray[numElements]);
247-
248-
Converts a 1D Perl Array Reference (C<AV*>) into a 1D C array of strings. The Perl array should contain string values.
249-
250-
=item C<PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r>
251-
252-
void PerlOMP_1D_Array_TO_1D_STRING_ARRAY_r(SV *AVref, int numElements, char *retArray[numElements]);
253-
254-
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.
255-
256-
=item C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY>
257-
258-
void PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY(SV *AoA, int numRows, int rowSize, float retArray[numRows][rowSize]);
259-
260-
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.
261-
262-
=item C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY_r>
263-
264-
void PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY_r(SV *AoA, int numRows, int rowSize, float retArray[numRows][rowSize]);
265-
266-
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.
267-
268-
=item C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY>
269-
270-
void PerlOMP_2D_AoA_TO_2D_INT_ARRAY(SV *AoA, int numRows, int rowSize, int retArray[numRows][rowSize]);
271-
272-
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.
273-
274-
=item C<PerlOMP_2D_AoA_TO_2D_INT_ARRAY_r>
275-
276-
void PerlOMP_2D_AoA_TO_2D_INT_ARRAY_r(SV *AoA, int numRows, int rowSize, int retArray[numRows][rowSize]);
277-
278-
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.
279-
280-
=item C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY>
281-
282-
void PerlOMP_2D_AoA_TO_2D_STRING_ARRAY(SV *AoA, int numRows, int rowSize, char *retArray[numRows][rowSize]);
283-
284-
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.
285-
286-
=item C<PerlOMP_2D_AoA_TO_2D_STRING_ARRAY_r>
287-
288-
void PerlOMP_2D_AoA_TO_2D_STRING_ARRAY_r(SV *AoA, int numRows, int rowSize, char *retArray[numRows][rowSize]);
289-
290-
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.
291-
292-
=back
293-
294-
=head1 PROVIDED ARRAY MEMBER VERIFICATION FUNCTIONS
295-
296-
=over 4
297-
298-
=item C<PerlOMP_VERIFY_1D_Array>
299-
300-
void PerlOMP_VERIFY_1D_Array(SV* array);
301-
302-
Verifies that the given Perl variable is a valid 1D array reference.
303-
304-
=item C<PerlOMP_VERIFY_1D_INT_ARRAY>
305-
306-
void PerlOMP_VERIFY_1D_INT_ARRAY(SV* array);
307-
308-
Verifies that the given 1D array contains only integer values.
309-
310-
=item C<PerlOMP_VERIFY_1D_FLOAT_ARRAY>
216+
=item C<PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY(AoA, num_nodes, dims, nodes)>
311217
312-
void PerlOMP_VERIFY_1D_FLOAT_ARRAY(SV* array);
218+
Used to extract the contents of a 2D rectangular Perl array reference that
219+
has been used to represent a 2D matrix.
313220
314-
Verifies that the given 1D array contains only floating-point values.
315-
316-
=item C<PerlOMP_VERIFY_1D_CHAR_ARRAY>
317-
318-
void PerlOMP_VERIFY_1D_CHAR_ARRAY(SV* array);
319-
320-
Verifies that the given 1D array contains only string values.
321-
322-
=item C<PerlOMP_VERIFY_2D_AoA>
323-
324-
void PerlOMP_VERIFY_2D_AoA(SV* array);
325-
326-
Verifies that the given Perl variable is a valid 2D array of arrays (AoA) reference.
327-
328-
=item C<PerlOMP_VERIFY_2D_INT_ARRAY>
329-
330-
void PerlOMP_VERIFY_2D_INT_ARRAY(SV* array);
331-
332-
Verifies that the given 2D array contains only integer values.
333-
334-
=item C<PerlOMP_VERIFY_2D_FLOAT_ARRAY>
335-
336-
void PerlOMP_VERIFY_2D_FLOAT_ARRAY(SV* array);
337-
338-
Verifies that the given 2D array contains only floating-point values.
339-
340-
=item C<PerlOMP_VERIFY_2D_STRING_ARRAY>
341-
342-
void PerlOMP_VERIFY_2D_STRING_ARRAY(SV* array);
343-
344-
Verifies that the given 2D array contains only string values.
221+
float nodes[num_nodes][dims];
222+
PerlOMP_2D_AoA_TO_2D_FLOAT_ARRAY(AoA, num_nodes, dims, nodes);
345223
346224
=back
347225
@@ -366,13 +244,6 @@ L<https://www.rperl.org>
366244
367245
Brett Estrade L<< <[email protected]> >>
368246
369-
=haed1 AI GENERATED CODE DISCLAIMER
370-
371-
Please be advised, for full transparency (and to set a good precedence),
372-
one should not that the conversion functions, verification functions, their
373-
POD entries, and testing functions werge generated with great assistance
374-
using the "I<Perl Programming Expert By DRAKOPOULOS ANASTASIOS>" chatGPT.
375-
376247
=head1 LICENSE & COPYRIGHT
377248
378249
Same as Perl.

0 commit comments

Comments
 (0)