<commit_before>#include "linalg.hpp"
#include "bini332.hpp"

#include <stdlib.h>
#include <time.h>

#include <chrono>  // note: C++11
#include <random>

int main(int argc, char **argv) {
    int m = 2700;
    int n = 400;
    int numsteps = 1;

    srand (time(NULL));

    Matrix<double> A(m, m);
    Matrix<double> B(m, n);
    Matrix<double> C1(m, n), C2(m, n);
    for (int j = 0; j < A.m(); ++j) {
        for (int i = 0; i < A.n(); ++i) {
            A.data()[i + j * A.stride()] = ((double) rand() / RAND_MAX) * 1024;
        }
    }
    for (int j = 0; j < B.n(); ++j) {
        for (int i = 0; i < B.m(); ++i) {
            B.data()[i + j * B.stride()] = ((double) rand() / RAND_MAX) * 1024;
        }
    }

    std::cout << "Running classical gemm..." << std::endl;
    auto t1 = std::chrono::high_resolution_clock::now();
    Gemm(A, B, C1);
    auto t2 = std::chrono::high_resolution_clock::now();
    std::cout << "Classical gemm took "
	      << std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count()
	      << " milliseconds"
	      << std::endl;

    std::cout << "Running fast matmul..." << std::endl;
    auto t3 = std::chrono::high_resolution_clock::now();
    FastMatmul(A, B, C2, numsteps);
    auto t4 = std::chrono::high_resolution_clock::now();
    std::cout << "Fast matmul took "
	      << std::chrono::duration_cast<std::chrono::milliseconds>(t4-t3).count()
	      << " milliseconds"
	      << std::endl;


    // Test for correctness.<commit_msg>Test two steps of recursion.<commit_after>#include "linalg.hpp"
#include "bini332.hpp"

#include <stdlib.h>
#include <time.h>

#include <chrono>  // note: C++11
#include <random>

int main(int argc, char **argv) {
    int m = 2700;
    int n = 400;
    int numsteps = 2;

    srand (time(NULL));

    Matrix<double> A(m, m);
    Matrix<double> B(m, n);
    Matrix<double> C1(m, n), C2(m, n);
    for (int j = 0; j < A.m(); ++j) {
        for (int i = 0; i < A.n(); ++i) {
            A.data()[i + j * A.stride()] = ((double) rand() / RAND_MAX) * 1024;
        }
    }
    for (int j = 0; j < B.n(); ++j) {
        for (int i = 0; i < B.m(); ++i) {
            B.data()[i + j * B.stride()] = ((double) rand() / RAND_MAX) * 1024;
        }
    }

    std::cout << "Running classical gemm..." << std::endl;
    auto t1 = std::chrono::high_resolution_clock::now();
    Gemm(A, B, C1);
    auto t2 = std::chrono::high_resolution_clock::now();
    std::cout << "Classical gemm took "
	      << std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count()
	      << " milliseconds"
	      << std::endl;

    std::cout << "Running fast matmul..." << std::endl;
    auto t3 = std::chrono::high_resolution_clock::now();
    FastMatmul(A, B, C2, numsteps, 1e-4);
    auto t4 = std::chrono::high_resolution_clock::now();
    std::cout << "Fast matmul took "
	      << std::chrono::duration_cast<std::chrono::milliseconds>(t4-t3).count()
	      << " milliseconds"
	      << std::endl;


    // Test for correctness.
{'fraction_non_alphanumeric': 0.20706902300766922, 'fraction_numerical': 0.025341780593531177, 'mean_word_length': 2.667481662591687, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7406106', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1118, 'n_words': 262}