My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for

Warning: this documentation is still under writing, please report any error.

usageExample  
How to use it and test it
Phase-Deploy, Featured, Phase-QA
en, it
Updated Jan 13, 2011 by paolo.ma...@gmail.com

Table of contents

Usage Example

In this section I show to you what you need to do to use engine_cudamrg in the better way.

For programmers

This section is on my TODO list, I will write it when I have enough time.

For end users

With version 0.1.0 of engine_cudamrg you need to rebuild the OpenSSL toolkit modifing two source file with the patch utility for having the speedup that a CUDA enabled device is able to provide.

In the following example we download, modify, build and install the OpenSSL tookit, we use /opt as target directory for both the OpenSSL toolkit and the engine_cudamrg but you can use any directory you want.

 $ wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
 $ wget http://engine-cuda.googlecode.com/files/engine_cudamrg-v_0.1.1.tar.gz
 $ tar xvzf openssl-0.9.8k.tar.gz 
 $ tar xvzf engine_cudamrg-v_0.1.1.tar.gz 
 $ patch ./openssl-0.9.8k/apps/speed.c ./engine_cudamrg/openssl-patch/openssl-0.9.8.k-apps_speed.c.patch 
 $ patch ./openssl-0.9.8k/crypto/evp/bio_enc.c ./engine_cudamrg/openssl-patch/openssl-0.9.8.k-crypto_evp_bio_c.c.patch 
 $ cd openssl-0.9.8k/
 $ ./config --prefix=/opt
 $ make
 $ sudo make install
 $ cd ../engine_cudamrg/
 $ ./configure --prefix=/opt
 $ make
 $ sudo make install
 $ /opt/bin/openssl engine -vvvv cudamrg -c

We can reassume what we have done with the following list:

  1. download both the OpenSSL toolkit and the engine_cudamrg
  2. untar the downloaded file
  3. patch the two source file that need modification
  4. configured, compiled and installed the OpenSSL toolkit
  5. configured, compiled and installed the engine_cudamrg
  6. sure that everything go well

Please note that in this example we haven't build the OpenSSL toolkit shared library, if you want to build the modified shared library you need to add the option shared to the config command-line but remember to modify the LD_LIBRARY_PATH to include the modified library directory before the original library directory.

 $ /opt/bin/openssl speed -engine cudamrg -evp aes-256-ecb
...

The designated buffer size will be the one that is highter.

 $ /opt/bin/openssl enc -engine cudamrg -e -aes-256-ecb -v -bufsize $DESIGNATED_BUFFER_SIZE -k $KEY -in $IN_FILE -out $OUT_FILE

For finding the buffer size that is better suited to your CUDA enabled device please use the modified version of speed that you have build, probably the resulted buffer size will be beatwen 256KB and 2MB depending from your hardware.

You can now use and test the engine but remember to use the buffer size that is better suited to the power of you CUDA enabled device in other case you can experience worst performance than with the CPU.

NOTE: in this example I use version 0.9.8k of the OpenSSL toolkit simply because is the one provided with my distribution.

How to use the test suite

Using the provided test suite is quite simple.

Running test-enc

The directory test-enc contains three shell script that execute the test and writes to disk the result and other four script that plot the result.

If you have the engine_cudamrg and the rebuilded version of OpenSSL set up correctly, you must change the variable 'OPENSSL' into the script test-enc-cpu.sh and test-enc-gpu.sh to point to the openssl executable.

After that you must execute the test-enc-gpu.sh, than rebuild the engine with the option --enable-cpuonly, execute the script test-enc-cpu.sh and execute the script test-enc-plot.sh for plotting the result. At the end remember to rebuild the engine without the option --enable-cpuonly.

These shell scripts produce as output 24 file, 4 for every cipher (encryption and decryption for both CPU and GPU), at the end you can plot the result if you want.

Running test-speed

The directory test-speed contains one shell script that execute the test and writes to disk the result and other four script that plot the result.

If you have the engine_cudamrg and the rebuilded version of OpenSSL set up correctly the only thing that you must do is modify the variable 'OPENSSL' into the script to point to the openssl executable.

The shell script produce as output 24 file, 4 for every cipher (encryption and decryption for both CPU and GPU), at the end it plot the result, you can also build tables in html, csv and wiki with the data used to draw the graphs using the script make-table-speed.sh.

Running test-file

The directory test-file contains one shell script that executes the test and writes to screen the result.

In order to execute correctly the test you MUST specify the variable 'INPUT_FILE' and 'INPUT_DIR' to a existing file and at the directory that contains it, optionally you could specify also a name for the output file with the variable 'OUTPUT_FILE' and specify a buffer size with the variable 'BUFSIZE'.

If you have the engine_cudamrg and the rebuilded version of OpenSSL set up correctly you MUST is modify the variable 'OPENSSL' into the script to point to the openssl executable.

The shell`s script encrypts and decrypts the provided file with all supported ciphers and compare the md5 of the decrypted file with the md5 of the original file, temporary file are stored into the directory specified with the variable 'OUTPUT_DIR'.

Comment by project member paolo.ma...@gmail.com, Sep 14, 2010

Hi, sorry if I respond to you only now. What you are reporting is quite strange, please could you report more information? I need to know the configuration of yours hardware (GPU & CPU) and software (distribution, cuda toolkit version, driver version, openssl & engine_cudamrg build configuration) environment. Thanks.

Comment by keza...@gmail.com, Feb 1, 2012

Hi, I have an error when running './configure --prefix=/opt' checking for openssl/aes.h... no configure: error: openssl/aes.h required

The file /opt/include/openssl/aes.h exists. Do you have any idea? thanks

Comment by project member paolo.ma...@gmail.com, Feb 1, 2012

Hi, it's quite strange, what version of openssl are you using? That file is readable? Do you have followed all instructions step by step?

Comment by keza...@gmail.com, Feb 3, 2012

Yes I use the same version as in your example. In fact when trying to run patch command as on line 5, I got this Reversed (or previously applied) patch detected! Assume -R? n?

Should I choose y or n?

Comment by project member paolo.ma...@gmail.com, Feb 3, 2012

Type y

Comment by keza...@gmail.com, Feb 3, 2012

It's ok now, I just have to make sure the patch are applied correctly.

I still do not see engine cudamrg though. $ /opt/bin/openssl engine (dynamic) Dynamic engine loading support (4758cca) IBM 4758 CCA hardware engine support (aep) Aep hardware engine support (atalla) Atalla hardware engine support (cswift) CryptoSwift? hardware engine support (chil) CHIL hardware engine support (nuron) Nuron hardware engine support (sureware) SureWare? hardware engine support (ubsec) UBSEC hardware engine support

So if I specify the engine: '/opt/bin/openssl speed -evp aes-128-cbc -engine cudamrg'. It is slower than just run with default engine '/opt/bin/openssl speed -evp aes-128-cbc -engine cudamrg'

I have cudatoolkit_4.1.28_linux_64_rhel5

Comment by keza...@gmail.com, Feb 3, 2012

In fact it seems to work, without '-engine cudamrg'. It is quite faster running '/opt/bin/openssl speed -evp aes-128-cbc' than with the default openssl(/usr/bin/openssl). Also the performance increase significantly with bigger block size, which looks like behavior of cuda engine.

Comment by linmeng...@gmail.com, Mar 29, 2012

Hi, I have also encountered an error when running:

'./configure --prefix=/opt' .
The error is
'checking for openssl/aes.h... no configure: error: openssl/aes.h required '.
I've configured, compiled and installed the OpenSSL toolkit following all instructions step by step. Do you have any ideas? Thanks.

Comment by project member paolo.ma...@gmail.com, Mar 30, 2012

If you did everything properly you should have no errors. What version of openssl you installed on?

Comment by linmeng...@gmail.com, Apr 5, 2012

As you said, I used command"wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz" to get openssl-0.9.8k. And then I tar it , patch it, config, make and make install. Then I go to /engine_cudamrg, and configured. The error comes that "configure: error: openssl/aes.h required".

Comment by linmeng...@gmail.com, Apr 6, 2012

I find that the openssl-1.0.0 is still used in my Ubuntu 11.10 after I install openssl-0.9.8k. When I use #Include <openssl/aes.h>, the compiler can't find it which is under /opt/include/openssl/aes.h. Do you have any ideas? Thanks.


Sign in to add a comment
Powered by Google Project Hosting