You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Abhishek Dhadwal <dh...@gmail.com> on 2019/04/11 07:15:16 UTC

[GSoC] Information Pertaining to Running Benchmarks

Dear Sir,

I have applied for the Apache ICLA, and built the project using - mvn clean package

>> I have already used maven to build the project. Should I try running
>> benchmark tests on the SecureRandom algorithms as discussed ? If so, are
>> there any guidelines/ data on doing so ?

>This is in module "commons-rng-examples/exmaples-jmh".
The site : https://commons.apache.org/proper/commons-rng/commons-rng-examples-jmh/apidocs/ gives a 404 error, and the user guide, as far as I recall, has not provided any information on testing.
Are there any reference sources/guides I can use for doing so ?

Regards, 
Abhishek Singh Dhadwal

Re: [rng] Information Pertaining to Running Benchmarks

Posted by Alex Herbert <al...@gmail.com>.

> On 16 May 2019, at 06:45, Abhishek Dhadwal <dh...@gmail.com> wrote:
> 
> On Thu, May 9, 2019 at 4:26 AM Alex Herbert <al...@gmail.com>
> wrote:
> 
> 
>> You have to run Maven from the appropriate sub-directory. Your screenshot
>> on Slack shows you are in the top level commons-rng directory:
>> 
>> $ cd commons-rng-examples/examples-jmh
>> $ mvn javadoc:javadoc
>> 
>> That should work.
>> 
>> It did! Thank you !
> 
>> The JMH tutorial requires you to download JMH from its own source
>> repository. They use Mercurial (an alternative source control system from
>> git). This is the ‘hg’ command (Mercury is element Hg) in the list of
>> instructions I sent.
>> 
>> Try running through them step-by-step. It should work as these are the
>> commands that I used to get it running.
>> 
>> Turned out I was building in a wrong directory.
> I changed the directories and tried building the JMH project in order to go
> through the tutorials using mvn clean install. I got a build failure. The
> error report is as follows :
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-javadoc-plugin:3.0.0-M1:jar (attach-javadoc)
> on project jmh-samples: MavenReportException: Error while generating
> Javadoc:
> [ERROR] Exit code: 1 - javadoc: error - The code being documented uses
> modules but the packages defined in
> http://docs.oracle.com/javase/7/docs/api/ are in the unnamed module.
> [ERROR]
> [ERROR] Command line was: "C:\Program
> Files\Java\jdk-11.0.2\bin\javadoc.exe" @options @packages
> [ERROR]
> [ERROR] Refer to the generated Javadoc files in
> 'C:\Users\abhi1\Documents\GitHub\commons-rng\jmh\jmh-samples\target\apidocs'
> dir.

This is due to stricter Java 11 implementation of Javadoc with regard to modules. It is the same error that prevented you from building the entire RNG project using Java 11. The fix (for Java 7) requires adding the <source>7</source> tag into the javadoc plugin of the pom. This is not worth it for just building JMH. I would recommend you install JDK 8 and make it your main java version. It would be rare that you need JDK 11 to build most software. You do not need it for anything you will do on the commons RNG project.

So for now install JDK 8 and try and run through the JMH tutorials.


Note that although it is possible for commons RNG to make it work under Java 11 to build the javadoc this then prevents a full build of the site for deployment as one of the plugins does not handle java 11 source. So commons RNG has to be built with java 9. This is an issue that may have to be resolved at the time of the next release. This problem with the strictness of javadoc in Java 11 is scheduled for fix in 11.0.3. All my attempts to make this work are documented here:

https://github.com/apache/commons-rng/pull/32 <https://github.com/apache/commons-rng/pull/32>


> 
>> Alex
>> 
> Regards,
> Abhishek


Re: [rng] Information Pertaining to Running Benchmarks

Posted by Abhishek Dhadwal <dh...@gmail.com>.
On Thu, May 9, 2019 at 4:26 AM Alex Herbert <al...@gmail.com>
wrote:


> You have to run Maven from the appropriate sub-directory. Your screenshot
> on Slack shows you are in the top level commons-rng directory:
>
> $ cd commons-rng-examples/examples-jmh
> $ mvn javadoc:javadoc
>
> That should work.
>
> It did! Thank you !

> The JMH tutorial requires you to download JMH from its own source
> repository. They use Mercurial (an alternative source control system from
> git). This is the ‘hg’ command (Mercury is element Hg) in the list of
> instructions I sent.
>
> Try running through them step-by-step. It should work as these are the
> commands that I used to get it running.
>
> Turned out I was building in a wrong directory.
I changed the directories and tried building the JMH project in order to go
through the tutorials using mvn clean install. I got a build failure. The
error report is as follows :
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-javadoc-plugin:3.0.0-M1:jar (attach-javadoc)
on project jmh-samples: MavenReportException: Error while generating
Javadoc:
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses
modules but the packages defined in
http://docs.oracle.com/javase/7/docs/api/ are in the unnamed module.
[ERROR]
[ERROR] Command line was: "C:\Program
Files\Java\jdk-11.0.2\bin\javadoc.exe" @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in
'C:\Users\abhi1\Documents\GitHub\commons-rng\jmh\jmh-samples\target\apidocs'
dir.

> Alex
>
Regards,
Abhishek

Re: [rng] Information Pertaining to Running Benchmarks

Posted by Alex Herbert <al...@gmail.com>.

> On 8 May 2019, at 20:02, Abhishek Dhadwal <dh...@gmail.com> wrote:
> 
> Dear Sir,
> If you want to look at the Javadocs then you can build them locally from 
> the commons-rng-examples/examples-jmh directory by running:
> 
> mvn javadoc:javadoc
> 
> The output will be in:
> 
> target/site/apidocs/index.html
> 
> There was no output. Kindly check the slack for more details. 

You have to run Maven from the appropriate sub-directory. Your screenshot on Slack shows you are in the top level commons-rng directory:

$ cd commons-rng-examples/examples-jmh
$ mvn javadoc:javadoc

That should work.

> FYI.
> 
> A good place to start with benchmarking would be to run through all the 
> tutorials in the JMH project:
> 
> https://openjdk.java.net/projects/code-tools/jmh/ <https://openjdk.java.net/projects/code-tools/jmh/>
> 
> Do this:
> 
>  > hg clone http://hg.openjdk.java.net/code-tools/jmh/ <http://hg.openjdk.java.net/code-tools/jmh/> jmh
> 
>  > cd jmh
> 
>  > hg up 1.21
> 
>  > cd jmh-samples
> 
> Then start reading the benchmark sample tutorials in:
> 
> src/main/java/org/openjdk/jmh/samples/
> 
> E.g. to run the first one:
> 
>  > mvn clean install
> 
>  > java -jar target/benchmarks.jar JMHSample_01
> 
>  I performed the required tasks, the following output happened :
> C:\Users\abhi1\Documents\GitHub\commons-rng> java -jar target/benchmarks.jar JMHSample_01
> Error: Unable to access jarfile target/benchmarks.jar
> I checked the folder, there was no file called 'benchmarks.jar'
> Regards,
> Abhishek

The JMH tutorial requires you to download JMH from its own source repository. They use Mercurial (an alternative source control system from git). This is the ‘hg’ command (Mercury is element Hg) in the list of instructions I sent.

Try running through them step-by-step. It should work as these are the commands that I used to get it running.

Alex



Re: [rng] Information Pertaining to Running Benchmarks

Posted by Alex Herbert <al...@gmail.com>.
Note: I have changed the subject line to prefix using [rng] since this 
is not related to [GSoC] but to the [rng] component.

On 11/04/2019 08:15, Abhishek Dhadwal wrote:
> Dear Sir,
>
> I have applied for the Apache ICLA, and built the project using - mvn clean package
>
>>> I have already used maven to build the project. Should I try running
>>> benchmark tests on the SecureRandom algorithms as discussed ? If so, are
>>> there any guidelines/ data on doing so ?
>> This is in module "commons-rng-examples/exmaples-jmh".
> The site : https://commons.apache.org/proper/commons-rng/commons-rng-examples-jmh/apidocs/ gives a 404 error

The site is only built per release. The link will be fixed in the next 
release.

If you want to look at the Javadocs then you can build them locally from 
the commons-rng-examples/examples-jmh directory by running:

mvn javadoc:javadoc

The output will be in:

target/site/apidocs/index.html

Or you could read the code.

> , and the user guide, as far as I recall, has not provided any information on testing.
> Are there any reference sources/guides I can use for doing so ?

This mailing list is the best resource.

What do you intend to test?

There is now a summary in the package-info.java file stating how to 
update the benchmarks if you have added a generator to the enum 
RandomSource in the commons-simple module.

For a quick start if you want to test the performance of a new random 
generator then (assuming you have the implementation somewhere) you can 
look at the baseline benchmarks such as NextIntGenerationPerformance.

A simple test would be to add state to the benchmark class that creates 
your generator and a new @Benchmark method that runs it:

     private UniformRandomProvider rngToTest = constructSomehow();

     @Benchmark
     public int testRng() {
         return rngToTest.nextInt();
     }

For a quick comparison to other providers I would edit 
RandomSourceValues to remove most of the generators you are not 
interested in.


FYI.

A good place to start with benchmarking would be to run through all the 
tutorials in the JMH project:

https://openjdk.java.net/projects/code-tools/jmh/

Do this:

 > hg clone http://hg.openjdk.java.net/code-tools/jmh/ jmh

 > cd jmh

 > hg up 1.21

 > cd jmh-samples

Then start reading the benchmark sample tutorials in:

src/main/java/org/openjdk/jmh/samples/

E.g. to run the first one:

 > mvn clean install

 > java -jar target/benchmarks.jar JMHSample_01

I will leave it up to you to experiment with the JMH settings. I find it 
useful to reduce the length of the iterations to 1 second from the 
default of 10. See:

 > java -jar target/benchmarks.jar -h


Alex

>
> Regards,
> Abhishek Singh Dhadwal
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org