{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "accelerator": "GPU", "colab": { "name": "Julia_1.6.0.ipynb", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "display_name": "Julia 1.6", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.0" } }, "cells": [ { "cell_type": "code", "metadata": { "id": "PMGwZ7aFJL8Y", "outputId": "59417b40-28ad-480b-80e6-240809f2c89b", "colab": { "base_uri": "https://localhost:8080/", "height": 86 } }, "source": [ "# Installation cell\n", "%%capture\n", "%%shell\n", "if ! command -v julia 3>&1 > /dev/null\n", "then\n", " wget -q 'https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.1-linux-x86_64.tar.gz' \\\n", " -O /tmp/julia.tar.gz\n", " tar -x -f /tmp/julia.tar.gz -C /usr/local --strip-components 1\n", " rm /tmp/julia.tar.gz\n", "fi\n", "julia -e 'using Pkg; pkg\"add IJulia; precompile;\"'\n", "echo 'Done'" ], "execution_count": 6, "outputs": [ { "output_type": "display_data", "data": { "text/latex": "Unrecognized magic \\texttt{\\%\\%capture}.\n\nJulia does not use the IPython \\texttt{\\%magic} syntax. To interact with the IJulia kernel, use \\texttt{IJulia.somefunction(...)}, for example. Julia macros, string macros, and functions can be used to accomplish most of the other functionalities of IPython magics.\n\n", "text/markdown": "Unrecognized magic `%%capture`.\n\nJulia does not use the IPython `%magic` syntax. To interact with the IJulia kernel, use `IJulia.somefunction(...)`, for example. Julia macros, string macros, and functions can be used to accomplish most of the other functionalities of IPython magics.\n", "text/plain": [ " Unrecognized magic \u001b[36m%%capture\u001b[39m.\n", "\n", " Julia does not use the IPython \u001b[36m%magic\u001b[39m syntax. To interact with the IJulia\n", " kernel, use \u001b[36mIJulia.somefunction(...)\u001b[39m, for example. Julia macros, string\n", " macros, and functions can be used to accomplish most of the other\n", " functionalities of IPython magics." ] }, "metadata": {} } ] }, { "cell_type": "markdown", "metadata": { "id": "XdMpcQduyaQc" }, "source": [ "After you run the first cell (the the cell directly above this text), go to Colab's menu bar and select **Edit** and select **Notebook settings** from the drop down. Select *Julia 1.6* in Runtime type. You can also select your prefered harwdware acceleration (defaults to GPU). \n", "\n", "
You should see something like this:\n", "\n", "> ![Colab Img](https://raw.githubusercontent.com/Dsantra92/Julia-on-Colab/master/misc/julia_menu.png)\n", "\n", "
Click on SAVE\n", "
**We are ready to get going**\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "metadata": { "id": "iIxu4TjlJnBG", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "8684ec42-0472-4d2f-9f4a-32fa08d02a74" }, "source": [ "VERSION" ], "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "v\"1.6.1\"" ] }, "metadata": { "tags": [] }, "execution_count": 1 } ] }, { "cell_type": "markdown", "metadata": { "id": "rR7Ox6Ax0ypi" }, "source": [ "**The next three cells are for GPU benchmarking. If you are using this notebook for the first time and have GPU enabled, you can give it a try.** " ] }, { "cell_type": "markdown", "metadata": { "id": "0y5TUI-Ll4cY" }, "source": [ "### Optional GPU Experiments" ] }, { "cell_type": "code", "metadata": { "id": "vHKANz2J0GDW", "outputId": "e6850b7b-c397-4696-cd7a-06b78d9820bf", "colab": { "base_uri": "https://localhost:8080/" } }, "source": [ "using Pkg\n", "Pkg.add([\"BenchmarkTools\", \"CUDA\"])\n", "using BenchmarkTools, CUDA\n", "\n", "if has_cuda_gpu()\n", " print(\"The GPU device is:\", CUDA.device())\n", "end" ], "execution_count": 3, "outputs": [ { "metadata": { "tags": null }, "name": "stderr", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General`\n", "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m OpenSpecFun_jll ───── v0.5.5+0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m Adapt ─────────────── v3.3.1\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m LLVMExtra_jll ─────── v0.0.10+0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m TimerOutputs ──────── v0.5.13\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m ExprTools ─────────── v0.1.6\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m BenchmarkTools ────── v1.2.0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m DocStringExtensions ─ v0.8.5\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m Compat ────────────── v3.38.0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m Random123 ─────────── v1.4.2\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m Requires ──────────── v1.1.3\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m LogExpFunctions ───── v0.3.3\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m ChainRulesCore ────── v1.6.0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m RandomNumbers ─────── v1.5.3\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m LLVM ──────────────── v4.5.3\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m CUDA ──────────────── v3.4.2\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m CEnum ─────────────── v0.4.1\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m BFloat16s ─────────── v0.1.0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m Reexport ──────────── v1.2.2\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m IrrationalConstants ─ v0.1.0\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m SpecialFunctions ──── v1.6.2\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m AbstractFFTs ──────── v1.0.1\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m GPUCompiler ───────── v0.12.9\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m GPUArrays ─────────── v8.1.1\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.6/Project.toml`\n", " \u001b[90m [6e4b80f9] \u001b[39m\u001b[92m+ BenchmarkTools v1.2.0\u001b[39m\n", " \u001b[90m [052768ef] \u001b[39m\u001b[92m+ CUDA v3.4.2\u001b[39m\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.6/Manifest.toml`\n", " \u001b[90m [621f4979] \u001b[39m\u001b[92m+ AbstractFFTs v1.0.1\u001b[39m\n", " \u001b[90m [79e6a3ab] \u001b[39m\u001b[92m+ Adapt v3.3.1\u001b[39m\n", " \u001b[90m [ab4f0b2a] \u001b[39m\u001b[92m+ BFloat16s v0.1.0\u001b[39m\n", " \u001b[90m [6e4b80f9] \u001b[39m\u001b[92m+ BenchmarkTools v1.2.0\u001b[39m\n", " \u001b[90m [fa961155] \u001b[39m\u001b[92m+ CEnum v0.4.1\u001b[39m\n", " \u001b[90m [052768ef] \u001b[39m\u001b[92m+ CUDA v3.4.2\u001b[39m\n", " \u001b[90m [d360d2e6] \u001b[39m\u001b[92m+ ChainRulesCore v1.6.0\u001b[39m\n", " \u001b[90m [34da2185] \u001b[39m\u001b[92m+ Compat v3.38.0\u001b[39m\n", " \u001b[90m [ffbed154] \u001b[39m\u001b[92m+ DocStringExtensions v0.8.5\u001b[39m\n", " \u001b[90m [e2ba6199] \u001b[39m\u001b[92m+ ExprTools v0.1.6\u001b[39m\n", " \u001b[90m [0c68f7d7] \u001b[39m\u001b[92m+ GPUArrays v8.1.1\u001b[39m\n", " \u001b[90m [61eb1bfa] \u001b[39m\u001b[92m+ GPUCompiler v0.12.9\u001b[39m\n", " \u001b[90m [92d709cd] \u001b[39m\u001b[92m+ IrrationalConstants v0.1.0\u001b[39m\n", " \u001b[90m [929cbde3] \u001b[39m\u001b[92m+ LLVM v4.5.3\u001b[39m\n", " \u001b[90m [2ab3a3ac] \u001b[39m\u001b[92m+ LogExpFunctions v0.3.3\u001b[39m\n", " \u001b[90m [74087812] \u001b[39m\u001b[92m+ Random123 v1.4.2\u001b[39m\n", " \u001b[90m [e6cf234a] \u001b[39m\u001b[92m+ RandomNumbers v1.5.3\u001b[39m\n", " \u001b[90m [189a3867] \u001b[39m\u001b[92m+ Reexport v1.2.2\u001b[39m\n", " \u001b[90m [ae029012] \u001b[39m\u001b[92m+ Requires v1.1.3\u001b[39m\n", " \u001b[90m [276daf66] \u001b[39m\u001b[92m+ SpecialFunctions v1.6.2\u001b[39m\n", " \u001b[90m [a759f4b9] \u001b[39m\u001b[92m+ TimerOutputs v0.5.13\u001b[39m\n", " \u001b[90m [dad2f222] \u001b[39m\u001b[92m+ LLVMExtra_jll v0.0.10+0\u001b[39m\n", " \u001b[90m [efe28fd5] \u001b[39m\u001b[92m+ OpenSpecFun_jll v0.5.5+0\u001b[39m\n", " \u001b[90m [8bb1440f] \u001b[39m\u001b[92m+ DelimitedFiles\u001b[39m\n", " \u001b[90m [8ba89e20] \u001b[39m\u001b[92m+ Distributed\u001b[39m\n", " \u001b[90m [4af54fe1] \u001b[39m\u001b[92m+ LazyArtifacts\u001b[39m\n", " \u001b[90m [37e2e46d] \u001b[39m\u001b[92m+ LinearAlgebra\u001b[39m\n", " \u001b[90m [9abbd945] \u001b[39m\u001b[92m+ Profile\u001b[39m\n", " \u001b[90m [1a1011a3] \u001b[39m\u001b[92m+ SharedArrays\u001b[39m\n", " \u001b[90m [2f01184e] \u001b[39m\u001b[92m+ SparseArrays\u001b[39m\n", " \u001b[90m [10745b16] \u001b[39m\u001b[92m+ Statistics\u001b[39m\n", " \u001b[90m [e66e0078] \u001b[39m\u001b[92m+ CompilerSupportLibraries_jll\u001b[39m\n", " \u001b[90m [05823500] \u001b[39m\u001b[92m+ OpenLibm_jll\u001b[39m\n", "\u001b[32m\u001b[1m Building\u001b[22m\u001b[39m Random123 → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/0e8b146557ad1c6deb1367655e052276690e71a3/build.log`\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[32m ✓ \u001b[39m\u001b[90mOpenLibm_jll\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mAbstractFFTs\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mDocStringExtensions\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mRequires\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mCEnum\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mExprTools\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mReexport\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mAdapt\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mCompat\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mBFloat16s\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mCompilerSupportLibraries_jll\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mIrrationalConstants\u001b[39m\n", "\u001b[32m ✓ \u001b[39mBenchmarkTools\n", "\u001b[32m ✓ \u001b[39m\u001b[90mRandomNumbers\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mTimerOutputs\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mLLVMExtra_jll\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mOpenSpecFun_jll\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mChainRulesCore\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mRandom123\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mGPUArrays\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mLogExpFunctions\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mLLVM\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mSpecialFunctions\u001b[39m\n", "\u001b[32m ✓ \u001b[39m\u001b[90mGPUCompiler\u001b[39m\n", "\u001b[32m ✓ \u001b[39mCUDA\n", " 25 dependencies successfully precompiled in 62 seconds (15 already precompiled)\n", "\u001b[32m\u001b[1m Downloading\u001b[22m\u001b[39m artifact: CUDA\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "The GPU device is:CuDevice(0)" ] } ] }, { "cell_type": "code", "metadata": { "id": "q7Mbcm00lnxO", "outputId": "bc6a9587-5be2-4b05-fad6-b8e9226b2b38", "colab": { "base_uri": "https://localhost:8080/" } }, "source": [ "mcpu = rand(2^10, 2^10)\n", "@benchmark mcpu*mcpu" ], "execution_count": 4, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "BenchmarkTools.Trial: 82 samples with 1 evaluation.\n", " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m56.400 ms\u001b[22m\u001b[39m … \u001b[35m74.484 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 3.67%\n", " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m60.914 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n", " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m61.581 ms\u001b[22m\u001b[39m ± \u001b[32m 3.354 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m0.68% ± 1.54%\n", "\n", " \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▆\u001b[39m▃\u001b[39m▄\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[34m█\u001b[39m\u001b[39m \u001b[32m▃\u001b[39m\u001b[39m \u001b[39m▃\u001b[39m▃\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", " \u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m▆\u001b[32m█\u001b[39m\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m▆\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m \u001b[39m▁\n", " 56.4 ms\u001b[90m Histogram: frequency by time\u001b[39m 74.1 ms \u001b[0m\u001b[1m<\u001b[22m\n", "\n", " Memory estimate\u001b[90m: \u001b[39m\u001b[33m8.00 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m2\u001b[39m." ] }, "metadata": {}, "execution_count": 4 } ] }, { "cell_type": "code", "metadata": { "id": "RMHRbF5J-vmW", "outputId": "7420e4e1-aa40-4150-f17b-883ca668f3dc", "colab": { "base_uri": "https://localhost:8080/" } }, "source": [ "println(\"The CuArrray operation should take around 0.5 ms(excluding CUDA downloading time which is a one time process), and should be much faster. If so, the GPU is working.\")\n", "mgpu = cu(mcpu)\n", "@benchmark CUDA.@sync mgpu*mgpu" ], "execution_count": 5, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "The CuArrray operation should take around 0.5 ms(excluding CUDA downloading time which is a one time process), and should be much faster. If so, the GPU is working.\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "BenchmarkTools.Trial: 3470 samples with 1 evaluation.\n", " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m962.769 μs\u001b[22m\u001b[39m … \u001b[35m383.623 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 1.51%\n", " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m 1.105 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n", " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m 1.431 ms\u001b[22m\u001b[39m ± \u001b[32m 11.102 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m0.32% ± 0.04%\n", "\n", " \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m▅\u001b[39m▇\u001b[34m█\u001b[39m\u001b[39m▆\u001b[39m▅\u001b[39m▃\u001b[39m▃\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", " \u001b[39m▁\u001b[39m▃\u001b[39m▅\u001b[39m▇\u001b[39m▆\u001b[39m█\u001b[39m▇\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▆\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▆\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m▃\n", " 963 μs\u001b[90m Histogram: frequency by time\u001b[39m 1.26 ms \u001b[0m\u001b[1m<\u001b[22m\n", "\n", " Memory estimate\u001b[90m: \u001b[39m\u001b[33m21.23 KiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m681\u001b[39m." ] }, "metadata": {}, "execution_count": 5 } ] }, { "cell_type": "code", "metadata": { "id": "vla4-2F7bvZO", "outputId": "bc018352-8329-4cc8-b66f-e121f2f94915", "colab": { "base_uri": "https://localhost:8080/" } }, "source": [ "] add GMT.jl" ], "execution_count": 9, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Installed\u001b[22m\u001b[39m GMT ─ v0.37.0\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.6/Project.toml`\n", " \u001b[90m [5752ebe1] \u001b[39m\u001b[92m+ GMT v0.37.0\u001b[39m\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.6/Manifest.toml`\n", " \u001b[90m [5752ebe1] \u001b[39m\u001b[92m+ GMT v0.37.0\u001b[39m\n", "\u001b[32m\u001b[1m Building\u001b[22m\u001b[39m GMT → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/dd5213e842cd5266f691c6efbcb71df450d7dec2/build.log`\n", "\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n", "\u001b[32m ✓ \u001b[39mGMT\n", " 1 dependency successfully precompiled in 312 seconds (40 already precompiled)\n" ] } ] }, { "cell_type": "code", "metadata": { "id": "ySGDN61n-0Sh" }, "source": [ "!sudo apt update\n", "!sudo apt upgrade -y\n", "!sudo apt install -y build-essential cmake libcurl4-gnutls-dev libnetcdf-dev gdal-bin libgdal-dev libfftw3-dev libpcre3-dev liblapack-dev libblas-dev libglib2.0-dev ghostscript ghostscript-x graphicsmagick ffmpeg xdg-utils" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "FQUdsF2YDDZ1" }, "source": [ "!git clone --depth 50 https://github.com/GenericMappingTools/gmt" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "XCRcav3EDWUC" }, "source": [ "!cmake /content/gmt" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "ChzivzSvDekS" }, "source": [ "!cmake --build . --target install" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "VgHFd17JdTKI" }, "source": [ "using GMT\n", "bar([0. 1 2 3; 1 2 3 4], stack=true, hbar=true, fill=[\"red\", \"green\", \"blue\"], show=true)" ], "execution_count": null, "outputs": [] } ] }