Skip to content

Instantly share code, notes, and snippets.

@genkuroki
Last active May 29, 2021 12:09
Show Gist options
  • Save genkuroki/6123aef79488bc20b52047656fc6f015 to your computer and use it in GitHub Desktop.
Save genkuroki/6123aef79488bc20b52047656fc6f015 to your computer and use it in GitHub Desktop.
Octavian!
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "https://discourse.julialang.org/t/intel-c-c-compiler-performance-versus-julia/61929/18"
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "versioninfo()",
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": "Julia Version 1.7.0-DEV.1129\nCommit 9117b4d6d6 (2021-05-20 16:42 UTC)\nPlatform Info:\n OS: Windows (x86_64-w64-mingw32)\n CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz\n WORD_SIZE: 64\n LIBM: libopenlibm\n LLVM: libLLVM-11.0.1 (ORCJIT, skylake)\nEnvironment:\n JULIA_NUM_THREADS = 12\n JULIA_PYTHONCALL_EXE = C:\\Users\\genkuroki\\.julia\\conda\\3\\python.exe\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "using LinearAlgebra\nusing BLASBenchmarksCPU\nusing Octavian\nusing BenchmarkHistograms",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "M = K = N = 1024\nA = rand(M, K)\nB = rand(K, N)\nC1 = @time(A * B)\nC0 = similar(C1);",
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": " 0.630451 seconds (2.53 M allocations: 142.127 MiB, 8.36% gc time, 97.14% compilation time)\n",
"name": "stdout"
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "@benchmark mul!($C0, $A, $B)",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 4,
"data": {
"text/plain": "samples: 311; evals/sample: 1; memory estimate: 0 bytes; allocs estimate: 0\nns\n\n (1.2e7 - 1.4e7] \u001b[32m██▏\u001b[39m13\n (1.4e7 - 1.6e7] \u001b[32m████████████████▍\u001b[39m103\n (1.6e7 - 1.8e7] \u001b[32m██████████████████████████████ \u001b[39m189\n (1.8e7 - 2.0e7] \u001b[32m▉\u001b[39m5\n (2.0e7 - 2.2e7] \u001b[32m \u001b[39m0\n (2.2e7 - 2.4e7] \u001b[32m \u001b[39m0\n (2.4e7 - 2.6e7] \u001b[32m \u001b[39m0\n (2.6e7 - 2.8e7] \u001b[32m \u001b[39m0\n (2.8e7 - 3.0e7] \u001b[32m \u001b[39m0\n (3.0e7 - 3.4e7] \u001b[32m▎\u001b[39m1\n\n Counts\n\nmin: 11.855 ms (0.00% GC); mean: 16.063 ms (0.00% GC); median: 16.017 ms (0.00% GC); max: 34.308 ms (0.00% GC)."
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# MKL dgemm\n@benchmark gemmmkl!($C0, $A, $B)",
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 5,
"data": {
"text/plain": "samples: 344; evals/sample: 1; memory estimate: 0 bytes; allocs estimate: 0\nns\n\n (1.0e7 - 1.1e7] \u001b[32m▋\u001b[39m4\n (1.1e7 - 1.3e7] \u001b[32m█▌\u001b[39m11\n (1.3e7 - 1.4e7] \u001b[32m███████▍\u001b[39m58\n (1.4e7 - 1.5e7] \u001b[32m██████████████████████████████ \u001b[39m239\n (1.5e7 - 1.7e7] \u001b[32m███▉\u001b[39m30\n (1.7e7 - 1.8e7] \u001b[32m \u001b[39m0\n (1.8e7 - 1.9e7] \u001b[32m \u001b[39m0\n (1.9e7 - 2.1e7] \u001b[32m \u001b[39m0\n (2.1e7 - 2.2e7] \u001b[32m \u001b[39m0\n (2.2e7 - 2.4e7] \u001b[32m▍\u001b[39m2\n\n Counts\n\nmin: 9.866 ms (0.00% GC); mean: 14.514 ms (0.00% GC); median: 14.654 ms (0.00% GC); max: 23.579 ms (0.00% GC)."
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# MKL dgemm_direct\n@benchmark gemmmkl_direct!($C0, $A, $B)",
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 6,
"data": {
"text/plain": "samples: 323; evals/sample: 1; memory estimate: 0 bytes; allocs estimate: 0\nns\n\n (1.0e7 - 1.09e7] \u001b[32m█▊\u001b[39m5\n (1.09e7 - 1.18e7] \u001b[32m▊\u001b[39m2\n (1.18e7 - 1.26e7] \u001b[32m██▍\u001b[39m7\n (1.26e7 - 1.35e7] \u001b[32m████\u001b[39m12\n (1.35e7 - 1.43e7] \u001b[32m████████▉\u001b[39m27\n (1.43e7 - 1.52e7] \u001b[32m██████████████████████████████ \u001b[39m92\n (1.52e7 - 1.6e7 ] \u001b[32m████████████████████████▎\u001b[39m74\n (1.6e7 - 1.69e7] \u001b[32m██████████▉\u001b[39m33\n (1.69e7 - 1.78e7] \u001b[32m████████████▏\u001b[39m37\n (1.78e7 - 1.86e7] \u001b[32m███████████▏\u001b[39m34\n\n Counts\n\nmin: 10.048 ms (0.00% GC); mean: 15.499 ms (0.00% GC); median: 15.280 ms (0.00% GC); max: 18.620 ms (0.00% GC)."
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "# Octavian.jl\n@benchmark matmul!($C0, $A, $B)",
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": "samples: 265; evals/sample: 1; memory estimate: 0 bytes; allocs estimate: 0\nns\n\n (1.4e7 - 1.7e7] \u001b[32m███▊\u001b[39m24\n (1.7e7 - 2.0e7] \u001b[32m██████████████████████████████ \u001b[39m198\n (2.0e7 - 2.3e7] \u001b[32m██████▍\u001b[39m42\n (2.3e7 - 2.5e7] \u001b[32m \u001b[39m0\n (2.5e7 - 2.8e7] \u001b[32m \u001b[39m0\n (2.8e7 - 3.1e7] \u001b[32m \u001b[39m0\n (3.1e7 - 3.4e7] \u001b[32m \u001b[39m0\n (3.4e7 - 3.7e7] \u001b[32m \u001b[39m0\n (3.7e7 - 4.0e7] \u001b[32m \u001b[39m0\n (4.0e7 - 4.6e7] \u001b[32m▎\u001b[39m1\n\n Counts\n\nmin: 14.231 ms (0.00% GC); mean: 18.854 ms (0.00% GC); median: 18.904 ms (0.00% GC); max: 45.967 ms (0.00% GC)."
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"@webio": {
"lastKernelId": null,
"lastCommId": null
},
"kernelspec": {
"name": "julia-1.7-depwarn-o3",
"display_name": "Julia 1.7.0-DEV depwarn -O3",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.7.0"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"base_numbering": 1,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"gist": {
"id": "6123aef79488bc20b52047656fc6f015",
"data": {
"description": "Octavian!",
"public": true
}
},
"_draft": {
"nbviewer_url": "https://gist.github.com/6123aef79488bc20b52047656fc6f015"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment