## Not run: ------------------------------------
# # Set needed environment variables for multithreading. Only single threading
# # is used in the example.
# #
# # Note: The environment variables are usually set by the user before starting
# # the R programming environment; they are set here only to facilitate
# # a working example. See the section on multithreading in the vignette
# # for further details.
# Sys.setenv(R_BENCH_NUM_THREADS_VARIABLE="MKL_NUM_THREADS")
# Sys.setenv(MKL_NUM_THREADS="1")
# #
# # Generate example microbenchmarks that can be run in a few minutes; see
# # the vignette for more involved examples. The matvec_laplacian7pt_100
# # and cholesky_ct20stif microbenchmarks are defined in the examples.
# #
# # Note: The example microbenchmarks are different than the microbenchmarks
# # generated by
# # \code{\link{GetSparseMatrixVectorDefaultMicrobenchmarks}},
# # \code{\link{GetSparseCholeskyDefaultMicrobenchmarks}},
# # \code{\link{GetSparseLuDefaultMicrobenchmarks}}, and
# # \code{\link{GetSparseQrDefaultMicrobenchmarks}};
# # they were chosen for their short run times and suitability for
# # example code.
# exampleMatrixVectorMicrobenchmarks <- GetSparseMatrixVectorExampleMicrobenchmarks()
# exampleCholeskyMicrobenchmarks <- GetSparseCholeskyExampleMicrobenchmarks()
# # Set the output directory of the CSV summary results files
# resultsDirectory <- "./SparseMatrixExampleOutput"
# # Create the output directory
# dir.create(resultsDirectory)
# # Set an appropriate run identifier
# runIdentifier <- "example"
# # Run only the matrix-vector and Cholesky factorization microbenchmarks, as
# # the others take a long time
# resultsFrame <- RunSparseMatrixBenchmark(runIdentifier, resultsDirectory,
# matrixVectorMicrobenchmarks=exampleMatrixVectorMicrobenchmarks,
# choleskyMicrobenchmarks=exampleCholeskyMicrobenchmarks,
# luMicrobenchmarks=NULL,
# qrMicrobenchmarks=NULL)
#
# # This example runs only the Cholesky factorization microbenchmarks.
# runIdentifier <- "choleksy_only"
# # Run only the sparse Choleksy factorization microbenchmarks
# choleskyResults <- RunSparseMatrixBenchmark(runIdentifier, resultsDirectory,
# matrixVectorMicrobenchmarks=NULL, luMicrobenchmarks=NULL,
# qrMicrobenchmarks=NULL)
#
## ---------------------------------------------
Run the code above in your browser using DataLab