Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate values computed for JEM buffers during benchmark #5

Open
allisterb opened this issue Dec 15, 2017 · 1 comment
Open

Validate values computed for JEM buffers during benchmark #5

allisterb opened this issue Dec 15, 2017 · 1 comment
Assignees
Labels

Comments

@allisterb
Copy link
Owner

General design for a benchmark run over an array/buffer should be:

  1. Compute the baseline value using builtin .NET operators and methods from System.Math.
  2. Compute the value using JEM methods.
  3. In the cleanup phase after each benchmark iteration compare the JEM/builitin values for each element in the array and throw an exception if any don't match.
@allisterb allisterb self-assigned this Dec 15, 2017
@allisterb
Copy link
Owner Author

Added in 88c3c2b. e.g for validating the array multiply benchmark:

            int index = GM<T>.Rng.Next(0, ArraySize);
            SafeArray<T> nativeArray = GetValue<SafeArray<T>>("nativeArray");
            T[] managedArray = GetValue<T[]>("managedArray");
            T mul = GetValue<T>("mul");
            T fill = GetValue<T>("fill");
            T val = GM<T>.Multiply(fill, mul);
            if (!nativeArray[index].Equals(val))
            {
                Log.WriteLineError($"Native array at index {index} is {nativeArray[index]} not {val}.");
                throw new Exception();
            }
            else if (!managedArray[index].Equals(val))
            {
                Log.WriteLineError($"Managed array at index {index} is {managedArray[index]} not {val}.");
                throw new Exception();
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant