Kappa for Perl
What is Kappa?
Kappa is an advanced software framework that makes it easy to bring the best performance to processing data by using relatively inexpensive highly parallel CPU and GPU hardware. Kappa works with your current programming languages and data sources. Kappa is ready to improve your TCO by implementing the production work loads of clusters of hundreds of servers on just a few servers.
Kappa for Perl
The combination of the KappaCUDA Perl module and the keyword Perl gives Perl as close to complete parity (other than performance) with C++ as GPU hardware (currently) allows. The KappaCUDA module allows access to CUDA via the Kappa Library while the keyword Perl allows running Perl subroutines on the host execution threads that have a CUDA GPU context (with access to the CUDA context, Variables, etc.). The standard Perl ‘threads:shared’ module may be used to communicate between the different Perl interpreters running on the different threads.
This Perl integration functionality gives CUDA programmers access to the very extensive Perl libraries available on CPAN. Use of these Perl CPAN libraries give CUDA programmers access to most major data formats.
- KappaCUDA-1.2.0.tar.gz (78.7 KB) June 26, 2010
- KappaCUDA.ppmx (651.94 KB) August 18, 2010
- keywordperl-1.2.0.tar.gz (11.61 KB) June 26, 2010
Installation and usage
KappaCUDA for ActiveState (Windows) is now available
The latest versions of these are distributed by the appropriate Kappa installation
As of version 1.2, these files are available in the Kappa installation in either the kappa-langauges RPM or DEB file or the Languages section of the Windows installer. Please use one of those installations for versions newer than version 1.2. The files on this page are no longer the most current. They are installed under either /usr/share/kappa/extras or C:\Program Files\Kappa\share\kappa\extras. The Perl keyword is in the keyword/Perl subfolder and the module is in the lanuages/perl subfolder.
Install the KappaCUDA module, after the Kappa Library and Kappa Library development files are installed, in the usual way for installing Perl modules:
tar zxvf KappaCUDA-1.2.0.tar.gz
Install the keywordperl by running the following commands (see the INSTALL file in the keyword/Perl directory):
Edit the keyword_perl.conf configuration file and replace <Path to keywordperl> with the appropriate path–usually /usr/local/lib or /usr/local/lib64. This keyword_perl.conf file also has a ‘[/kappa/perl]‘ section that is only an example that corresponds to the perl_example.pl and keyword_perl_example.pl files that are distributed as part of keywordperl. In that section, the script_file parameter specifies the name of a Perl script to be used if the main program is not Perl. If the main program is Perl, then the script_file parameter is not used. Parameters of the form: <name>_prepare and <name>_execute translate a function name given in a Kappa command to corresponding Perl subroutines. For example, if the Kappa command:
!Perl -> name(1,2,3,A) [ A= ];
is given, then the ‘name’ has ‘_prepare’ and ‘_execute’ appended to it and are used to lookup Perl subroutines names in the ‘[/kappa/perl]‘ section of the configuration file. Example Perl subroutines foo_prep and foo_exec are present in the perl_example.pl and keyword_perl_example.pl Perl scripts. If the final return from foo_exec is ‘return (1, 0);’ (instead of ‘return (1, 1);’ ), then perl.k will display the first two rows of the Variable values set in the foo_exec routine.
Once the keyword_perl.conf file is configured correctly, copy it to the either the ‘/etc/kappa.d’ or the ‘~/.kappa.d’ directory.
If everything for the KappaCUDA module and keyword Perl shared library is configured and installed properly, then running:
perl perl_example.pl perl.k
ikappa -c perl.k
should produce the following output:
Execute arguments: 4
Execute arguments: 1 2 3 /kappa/context/main/context/A
Variable dimensions: 2
Variable bounds: 48 80
Variable element size: 4
A firstrow 0 1 2 3 4 5 6 7 89 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
A secondrow 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
(Executing the perl_example.pl will also produce a final line: ‘executed’ that demonstrates the communication between the GPU thread Perl interpreter and the main Perl interpreter script.)
SWIG files for Kappa
The following files allow wrapping the Kappa Library for use by the languages supported by SWIG. Perl and Python have been tested as working properly.
KappaCUDA and KeywordPerl License terms
The KappaCUDA and KeywordPerl files are licensed under the following MIT license:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Trivial modifications of KappaCUDA, KeywordPerl, or KappaCUDA.i derived works do not qualify as software applications for the Kappa Library Developer License.