├── .gitignore ├── Make.inc ├── Makefile ├── README.md ├── VERSION ├── _deps ├── .gitignore ├── Makefile ├── SuiteSparse_wrapper.c ├── Versions.make ├── checksums │ ├── Rmath-julia-0.1.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── SuiteSparse-4.4.2.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── arpack-ng-3.2.0.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── cfe-3.6.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── compiler-rt-3.6.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── dsfmt-2.2.3.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── fftw-3.3.4.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── git-1.8.5.6.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── gmp-6.0.0.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 │ ├── lapack-3.5.0.tgz │ │ ├── md5 │ │ └── sha512 │ ├── libcxx-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libgit2-f6dedf2c2eb806e2a6fdd4cf31f68386efc2ee0b.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libosxunwind-0.0.1.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libunwind-1.1.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── libuv-9ab431a88fe255dd21e19a11f7fa2dd95774abf4.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── lldb-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── lldb-3.5.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.3-i686-w64-mingw32-juliadeps.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.3-x86_64-w64-mingw32-juliadeps.7z │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.3.src.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.5.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.5.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.6.0.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── llvm-3.6.1.src.tar.xz │ │ ├── md5 │ │ └── sha512 │ ├── mpfr-3.1.2.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── openblas-53e849f4fcae4363a64576de00e982722c7304f9.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── patchelf-0.8.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── pcre2-10.20.tar.bz2 │ │ ├── md5 │ │ └── sha512 │ ├── utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz │ │ ├── md5 │ │ └── sha512 │ ├── virtualenv-1.11.6.tar.gz │ │ ├── md5 │ │ └── sha512 │ └── x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z │ │ ├── md5 │ │ └── sha512 ├── dSFMT.c.patch ├── dSFMT.h.patch ├── find_python2 ├── gfortblas.alias ├── gfortblas.c ├── gmp_6.0.0_osx.patch ├── instcombine-llvm-3.3.patch ├── int128-vector.llvm-3.3.patch ├── jlchecksum ├── jldownload ├── libdSFMT.def ├── libgit2.version ├── libunwind.patch ├── libuv.version ├── openblas.version ├── openlibm.version ├── openspecfun.version ├── osx-10.10.llvm-3.3.patch ├── utf8proc.version ├── valgrind │ └── valgrind.h ├── win64-allocas-llvm-3.6.0.patch ├── win64-int128.llvm-3.3.patch └── zerosign-llvm-3.6.0.patch ├── _original ├── README.md ├── devdocs │ ├── C.rst │ ├── ast.rst │ ├── backtraces.rst │ ├── cartesian.rst │ ├── debuggingtips.rst │ ├── eval.rst │ ├── init.rst │ ├── julia.rst │ ├── llvm.rst │ ├── meta.rst │ ├── object.rst │ ├── promote-op.rst │ ├── reflection.rst │ ├── stdio.rst │ ├── subarrays.rst │ ├── sysimg.rst │ ├── types.rst │ └── valgrind.rst ├── index.rst ├── latex.rst ├── manual │ ├── arrays.rst │ ├── calling-c-and-fortran-code.rst │ ├── complex-and-rational-numbers.rst │ ├── constructors.rst │ ├── control-flow.rst │ ├── conversion-and-promotion.rst │ ├── dates.rst │ ├── documentation.rst │ ├── embedding.rst │ ├── faq.rst │ ├── functions.rst │ ├── getting-started.rst │ ├── index.rst │ ├── integers-and-floating-point-numbers.rst │ ├── interacting-with-julia.rst │ ├── interfaces.rst │ ├── introduction.rst │ ├── linear-algebra.rst │ ├── mathematical-operations.rst │ ├── metaprogramming.rst │ ├── methods.rst │ ├── modules.rst │ ├── networking-and-streams.rst │ ├── noteworthy-differences.rst │ ├── packages.rst │ ├── parallel-computing.rst │ ├── performance-tips.rst │ ├── profile.rst │ ├── running-external-programs.rst │ ├── strings.rst │ ├── style-guide.rst │ ├── types.rst │ ├── unicode-input-table.rst │ ├── unicode-input.rst │ ├── variables-and-scoping.rst │ ├── variables.rst │ └── workflow-tips.rst └── stdlib │ ├── arrays.rst │ ├── base.rst │ ├── c.rst │ ├── collections.rst │ ├── constants.rst │ ├── dates.rst │ ├── file.rst │ ├── index.rst │ ├── io-network.rst │ ├── libc.rst │ ├── libdl.rst │ ├── linalg.rst │ ├── math.rst │ ├── numbers.rst │ ├── parallel.rst │ ├── pkg.rst │ ├── profile.rst │ ├── punctuation.rst │ ├── sort.rst │ ├── strings.rst │ └── test.rst ├── conf.py ├── devdocs ├── C.rst ├── ast.rst ├── backtraces.rst ├── cartesian.rst ├── debuggingtips.rst ├── eval.rst ├── init.rst ├── julia.rst ├── llvm.rst ├── meta.rst ├── object.rst ├── promote-op.rst ├── reflection.rst ├── stdio.rst ├── subarrays.rst ├── sysimg.rst ├── types.rst └── valgrind.rst ├── images ├── github_metadata_develbranch.png ├── github_metadata_fork.png ├── github_metadata_pullrequest.png ├── jltypes.ai ├── jltypes.svg └── travis-icon.png ├── index.rst ├── latex.rst ├── man └── julia.1 ├── manual ├── arrays.rst ├── calling-c-and-fortran-code.rst ├── complex-and-rational-numbers.rst ├── constructors.rst ├── control-flow.rst ├── conversion-and-promotion.rst ├── dates.rst ├── documentation.rst ├── embedding.rst ├── faq.rst ├── functions.rst ├── getting-started.rst ├── index.rst ├── integers-and-floating-point-numbers.rst ├── interacting-with-julia.rst ├── interfaces.rst ├── introduction.rst ├── linear-algebra.rst ├── mathematical-operations.rst ├── metaprogramming.rst ├── methods.rst ├── modules.rst ├── networking-and-streams.rst ├── noteworthy-differences.rst ├── packages.rst ├── parallel-computing.rst ├── performance-tips.rst ├── profile.rst ├── running-external-programs.rst ├── strings.rst ├── style-guide.rst ├── types.rst ├── unicode-input-table.rst ├── unicode-input.rst ├── variables-and-scoping.rst ├── variables.rst └── workflow-tips.rst ├── requirements.txt └── stdlib ├── arrays.rst ├── base.rst ├── c.rst ├── collections.rst ├── constants.rst ├── dates.rst ├── file.rst ├── index.rst ├── io-network.rst ├── libc.rst ├── libdl.rst ├── linalg.rst ├── math.rst ├── numbers.rst ├── parallel.rst ├── pkg.rst ├── profile.rst ├── punctuation.rst ├── sort.rst ├── strings.rst └── test.rst /.gitignore: -------------------------------------------------------------------------------- 1 | UnicodeData.txt 2 | _build/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | 3 | default: html 4 | 5 | # You can set these variables from the command line. 6 | SPHINXOPTS = 7 | PAPER = 8 | DEPS = $(abspath ./_deps) 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | # the i18n builder cannot share the environment and doctrees with the others 15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 16 | 17 | JULIA_ENV = $(DEPS)/julia-env 18 | ACTIVATE = $(JULIA_ENV)/bin/activate 19 | SPHINX_BUILD = $(JULIA_ENV)/bin/sphinx-build 20 | 21 | $(ACTIVATE): 22 | $(MAKE) -C $(DEPS) install-virtualenv 23 | touch -c $@ 24 | 25 | $(SPHINX_BUILD): $(ACTIVATE) requirements.txt 26 | . $(ACTIVATE) && pip install sphinx==1.3.1 \ 27 | && pip install -r requirements.txt 28 | touch -c $@ 29 | 30 | SPHINXBUILD = . $(ACTIVATE) && sphinx-build 31 | 32 | .PHONY: help clean cleanall html dirhtml singlehtml pickle json htmlhelp qthelp devhelp \ 33 | epub latex latexpdf text man changes linkcheck doctest gettext 34 | 35 | help: 36 | @echo "Please use 'make ' where is one of" 37 | @echo " html to make standalone HTML files" 38 | @echo " dirhtml to make HTML files named index.html in directories" 39 | @echo " singlehtml to make a single large HTML file" 40 | @echo " pickle to make pickle files" 41 | @echo " json to make JSON files" 42 | @echo " htmlhelp to make HTML files and a HTML help project" 43 | @echo " qthelp to make HTML files and a qthelp project" 44 | @echo " devhelp to make HTML files and a Devhelp project" 45 | @echo " epub to make an epub" 46 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 47 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 48 | @echo " text to make text files" 49 | @echo " man to make manual pages" 50 | @echo " texinfo to make Texinfo files" 51 | @echo " info to make Texinfo files and run them through makeinfo" 52 | @echo " gettext to make PO message catalogs" 53 | @echo " changes to make an overview of all changed/added/deprecated items" 54 | @echo " linkcheck to check all external links for integrity" 55 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 56 | 57 | clean: 58 | -rm -rf _build/* 59 | 60 | cleanall: clean 61 | 62 | html: $(SPHINX_BUILD) 63 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html 64 | @echo 65 | @echo "Build finished. The HTML pages are in _build/html." 66 | 67 | dirhtml: $(SPHINX_BUILD) 68 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml 69 | @echo 70 | @echo "Build finished. The HTML pages are in _build/dirhtml." 71 | 72 | singlehtml: $(SPHINX_BUILD) 73 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) _build/singlehtml 74 | @echo 75 | @echo "Build finished. The HTML page is in _build/singlehtml." 76 | 77 | pickle: $(SPHINX_BUILD) 78 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle 79 | @echo 80 | @echo "Build finished; now you can process the pickle files." 81 | 82 | json: $(SPHINX_BUILD) 83 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json 84 | @echo 85 | @echo "Build finished; now you can process the JSON files." 86 | 87 | htmlhelp: $(SPHINX_BUILD) 88 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp 89 | @echo 90 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 91 | ".hhp project file in _build/htmlhelp." 92 | 93 | qthelp: $(SPHINX_BUILD) 94 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp 95 | @echo 96 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 97 | ".qhcp project file in _build/qthelp, like this:" 98 | @echo "# qcollectiongenerator _build/qthelp/JuliaLanguage.qhcp" 99 | @echo "To view the help file:" 100 | @echo "# assistant -collectionFile _build/qthelp/JuliaLanguage.qhc" 101 | 102 | devhelp: $(SPHINX_BUILD) 103 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) _build/devhelp 104 | @echo 105 | @echo "Build finished." 106 | @echo "To view the help file:" 107 | @echo "# mkdir -p $$HOME/.local/share/devhelp/JuliaLanguage" 108 | @echo "# ln -s _build/devhelp $$HOME/.local/share/devhelp/JuliaLanguage" 109 | @echo "# devhelp" 110 | 111 | epub: $(SPHINX_BUILD) 112 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) _build/epub 113 | @echo 114 | @echo "Build finished. The epub file is in _build/epub." 115 | 116 | latex: $(SPHINX_BUILD) 117 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex 118 | @echo 119 | @echo "Build finished; the LaTeX files are in _build/latex." 120 | @echo "Run 'make' in that directory to run these through (pdf)latex" \ 121 | "(use 'make latexpdf' here to do that automatically)." 122 | 123 | latexpdf: $(SPHINX_BUILD) 124 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex 125 | @echo "Running LaTeX files through pdflatex..." 126 | $(MAKE) -C _build/latex all-pdf 127 | @echo "pdflatex finished; the PDF files are in _build/latex." 128 | 129 | text: $(SPHINX_BUILD) 130 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) _build/text 131 | @echo 132 | @echo "Build finished. The text files are in _build/text." 133 | 134 | man: $(SPHINX_BUILD) 135 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) _build/man 136 | @echo 137 | @echo "Build finished. The manual pages are in _build/man." 138 | 139 | texinfo: $(SPHINX_BUILD) 140 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo 141 | @echo 142 | @echo "Build finished. The Texinfo files are in _build/texinfo." 143 | @echo "Run 'make' in that directory to run these through makeinfo" \ 144 | "(use 'make info' here to do that automatically)." 145 | 146 | info: $(SPHINX_BUILD) 147 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo 148 | @echo "Running Texinfo files through makeinfo..." 149 | make -C _build/texinfo info 150 | @echo "makeinfo finished; the Info files are in _build/texinfo." 151 | 152 | gettext: $(SPHINX_BUILD) 153 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) _build/locale 154 | @echo 155 | @echo "Build finished. The message catalogs are in _build/locale." 156 | 157 | changes: $(SPHINX_BUILD) 158 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes 159 | @echo 160 | @echo "The overview file is in _build/changes." 161 | 162 | linkcheck: $(SPHINX_BUILD) 163 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck 164 | @echo 165 | @echo "Link check complete; look for any errors in the above output " \ 166 | "or in _build/linkcheck/output.txt." 167 | 168 | doctest: $(SPHINX_BUILD) 169 | PATH="$(PATH):$(build_bindir)" $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest 170 | @echo "Testing of doctests in the sources finished, look at the " \ 171 | "results in _build/doctest/output.txt." 172 | 173 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 別プロジェクトとして https://github.com/hshindo/julia-doc-ja-v0.6 もご覧ください。 2 | 3 | Julia 公式ドキュメント翻訳 4 | ========================== 5 | 6 | プログラミング言語「Julia」公式ドキュメントの日本語翻訳プロジェクトです。 7 | 8 | 原文は [docs.julialang.org](http://docs.julialang.org) 、邦訳は [docs.julia.tokyo](http://docs.julia.tokyo) で見ることができます。 9 | 10 | ドキュメントは、Read The Docsを使って公開されています ([プロジェクトページ](https://readthedocs.org/projects/julia-doc-ja))。 11 | 12 | 13 | ## あなたも翻訳してみませんか? 14 | 15 | 翻訳される方、いつでも募集中です!一部分でも大歓迎です。 16 | 17 | もちろん、誤訳や分かりづらい表現に対する指摘も、とてもありがたいです。ぜひ気軽に[イシューを立ててください](https://github.com/JuliaTokyo/julia-doc-ja/issues)! 18 | 19 | 翻訳は、より多くの方が情報を得るための助けになりますし、また、翻訳者自身の知識習得という面でも非常に有効だと思います。 20 | 21 | ### 翻訳の手順 22 | 23 | まずこのレポジトリを「Fork」し、自分のレポジトリ上で「編集・翻訳」、そしてそれを「Pull Request」として送っていただければ、こちらでチェックをして取り込みます。 24 | 25 | ドキュメントは、大きく分けて以下の3セクションに分かれています。 26 | 27 | * マニュアル `manual/` 28 | * 標準ライブラリ `stdlib/` 29 | * 開発者向けライブラリ `devdocs/` 30 | 31 | 翻訳は現在、release-0.4のものを元に行っています。翻訳文と直接対応する原文は `_original/` にあります。 32 | 33 | 現在進行中の翻訳作業については、[Pull Requests](https://github.com/JuliaTokyo/julia-doc-ja/pulls)で確認することができます。 34 | 35 | ドキュメントはreStructuredText(rST)形式で書かれています。rSTについては、[Python開発者ガイドのドキュメンテーションに関する章](https://docs.python.org/devguide/documenting.html)(英語)が参考になるでしょう。 36 | 37 | プロジェクトのルート・ディレクトリで以下のコマンドを実行すると、rSTファイルをHTMLファイルに変換して、実際の見た目を確認することができます。生成されたHTMLファイルは `_build/html` に置かれます。 38 | 39 | ``` 40 | $ make html 41 | ``` 42 | 43 | 44 | ### スタイル・ガイド 45 | 46 | ある程度の一貫性を保つため、簡単な[翻訳スタイル・ガイド](https://github.com/JuliaTokyo/julia-doc-ja/wiki/%E7%BF%BB%E8%A8%B3%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB%E3%83%BB%E3%82%AC%E3%82%A4%E3%83%89)をWikiに用意しています。 47 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.4 2 | -------------------------------------------------------------------------------- /_deps/.gitignore: -------------------------------------------------------------------------------- 1 | /arpack-* 2 | /cfe-* 3 | /clang-* 4 | /Clp-* 5 | /clp-* 6 | /compiler-rt-* 7 | /dsfmt-* 8 | /fftw-* 9 | !fftw-config-nopthreads.patch 10 | /git-* 11 | /gmp-* 12 | /lapack-* 13 | /libunwind-* 14 | /libosxunwind-* 15 | /lighttpd-* 16 | /libcxx-* 17 | /libcxxabi-* 18 | /libffi-* 19 | /llvm-* 20 | /lldb-* 21 | /mpfr-* 22 | /patchelf-* 23 | /pcre2-* 24 | /root 25 | /SuiteSparse-* 26 | /zlib-* 27 | /librandom.* 28 | /virtualenv-* 29 | /julia-env 30 | /objconv* 31 | /Rmath-julia* 32 | 33 | # git-externals: 34 | /libgit2 35 | /libgit2-* 36 | /libuv 37 | /libuv-* 38 | /openblas 39 | /openblas-* 40 | /openlibm 41 | /openlibm-* 42 | /openspecfun 43 | /openspecfun-* 44 | /utf8proc 45 | /utf8proc-* 46 | -------------------------------------------------------------------------------- /_deps/SuiteSparse_wrapper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern size_t jl_cholmod_common_size(void) { 5 | return sizeof(cholmod_common); 6 | } 7 | 8 | extern size_t jl_cholmod_sizeof_long(void) { 9 | return sizeof(SuiteSparse_long); 10 | } 11 | 12 | extern int jl_cholmod_version(int *ver) { 13 | if (ver != (int*) NULL) { 14 | ver[0] = CHOLMOD_MAIN_VERSION; 15 | ver[1] = CHOLMOD_SUB_VERSION; 16 | ver[2] = CHOLMOD_SUBSUB_VERSION; 17 | } 18 | return CHOLMOD_VERSION; 19 | } 20 | 21 | extern void jl_cholmod_common_offsets(size_t *vv) { 22 | vv[0] = offsetof(cholmod_common, dbound); 23 | vv[1] = offsetof(cholmod_common, maxrank); 24 | vv[2] = offsetof(cholmod_common, supernodal_switch); 25 | vv[3] = offsetof(cholmod_common, supernodal); 26 | vv[4] = offsetof(cholmod_common, final_asis); 27 | vv[5] = offsetof(cholmod_common, final_super); 28 | vv[6] = offsetof(cholmod_common, final_ll); 29 | vv[7] = offsetof(cholmod_common, final_pack); 30 | vv[8] = offsetof(cholmod_common, final_monotonic); 31 | vv[9] = offsetof(cholmod_common, final_resymbol); 32 | vv[10] = offsetof(cholmod_common, prefer_zomplex); 33 | vv[11] = offsetof(cholmod_common, prefer_upper); 34 | vv[12] = offsetof(cholmod_common, print); 35 | vv[13] = offsetof(cholmod_common, precise); 36 | vv[14] = offsetof(cholmod_common, nmethods); 37 | vv[15] = offsetof(cholmod_common, selected); 38 | vv[16] = offsetof(cholmod_common, postorder); 39 | vv[17] = offsetof(cholmod_common, itype); 40 | vv[18] = offsetof(cholmod_common, dtype); 41 | } 42 | -------------------------------------------------------------------------------- /_deps/Versions.make: -------------------------------------------------------------------------------- 1 | LLVM_VER = 3.3 2 | LLVM_LIB_SUFFIX = 3 | PCRE_VER = 10.20 4 | DSFMT_VER = 2.2.3 5 | LAPACK_VER = 3.5.0 6 | ARPACK_VER = 3.2.0 7 | FFTW_VER = 3.3.4 8 | SUITESPARSE_VER = 4.4.2 9 | UNWIND_VER = 1.1 10 | OSXUNWIND_VER = 0.0.1 11 | GMP_VER=6.0.0 12 | MPFR_VER=3.1.2 13 | PATCHELF_VER = 0.8 14 | GIT_VER = 1.8.5.6 15 | VIRTUALENV_VER = 1.11.6 16 | RMATH_JULIA_VER = 0.1 17 | -------------------------------------------------------------------------------- /_deps/checksums/Rmath-julia-0.1.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 4e3f9e41e7b8cd3070225d1f5e8b21d9 2 | -------------------------------------------------------------------------------- /_deps/checksums/Rmath-julia-0.1.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 1dd94eca05bc06c3f33e8be5087d3b1742d01c8b38588e0fa79b8f6b9998760bca21bee1b65873825c4dde2d994a8271166bc21f670a34810fa9db598473a887 2 | -------------------------------------------------------------------------------- /_deps/checksums/SuiteSparse-4.4.2.tar.gz/md5: -------------------------------------------------------------------------------- 1 | db3560d96ae78fb28b8996b5be7194b1 2 | -------------------------------------------------------------------------------- /_deps/checksums/SuiteSparse-4.4.2.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 00425b94f5955e44b7ef6faf7773d23977827a74fe86833cf3cd8532eb4b42a0971e3cfb07caa3df990da2cf95947ad23fd429fd169270a016b1145e4f6b0c11 2 | -------------------------------------------------------------------------------- /_deps/checksums/arpack-ng-3.2.0.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0ae8a0bb796370b06647d9e005c0f3ea 2 | -------------------------------------------------------------------------------- /_deps/checksums/arpack-ng-3.2.0.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 50c8a9b43eeb23100265b06c1ce0d5a80dbc7fef2a48911c9cdcaeee3d19f2875e5282b7ec462375e4be70676d27bff8f892ea120bb5881fdcee2b8c558b061e 2 | -------------------------------------------------------------------------------- /_deps/checksums/cfe-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 8284891e3e311829b8e44ac813d0c9ef 2 | -------------------------------------------------------------------------------- /_deps/checksums/cfe-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc 2 | -------------------------------------------------------------------------------- /_deps/checksums/cfe-3.6.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 9ff6811757735051f8651833b22ae014 2 | -------------------------------------------------------------------------------- /_deps/checksums/cfe-3.6.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | a96944bccfd9341be7adafdcc40367d458e85e7e74b0d2f3a7ea18edf1454d04a232c2d0003d6449c52f81d1e235b434acc1bb63eb5f7d16f8f4a43b70826743 2 | -------------------------------------------------------------------------------- /_deps/checksums/compiler-rt-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 9c129ce24514467cfe492cf2fed8e2c4 2 | -------------------------------------------------------------------------------- /_deps/checksums/compiler-rt-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 2 | -------------------------------------------------------------------------------- /_deps/checksums/compiler-rt-3.6.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 6f204b1feb324b1672ac907b32d927c0 2 | -------------------------------------------------------------------------------- /_deps/checksums/compiler-rt-3.6.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | 121c048fe60bccccd4a188a18613c94e1e1d9abd8fbae6405d23418f0c9b3562fff72fe77aea9bc0f8632ec9ad89503b9c67fcab5bf378001f90ad7492a1845a 2 | -------------------------------------------------------------------------------- /_deps/checksums/dsfmt-2.2.3.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 057c5a11d28296825fba584f561a4369 2 | -------------------------------------------------------------------------------- /_deps/checksums/dsfmt-2.2.3.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662 2 | -------------------------------------------------------------------------------- /_deps/checksums/fftw-3.3.4.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 2edab8c06b24feeb3b82bbb3ebf3e7b3 2 | -------------------------------------------------------------------------------- /_deps/checksums/fftw-3.3.4.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 1ee2c7bec3657f6846e63c6dfa71410563830d2b951966bf0123bd8f4f2f5d6b50f13b76d9a7b0eae70e44856f829ca6ceb3d080bb01649d1572c9f3f68e8eb1 2 | -------------------------------------------------------------------------------- /_deps/checksums/git-1.8.5.6.tar.gz/md5: -------------------------------------------------------------------------------- 1 | c437b3485cb157f8e84e5b2ccb135885 2 | -------------------------------------------------------------------------------- /_deps/checksums/git-1.8.5.6.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | fd004a5a99e8ff80556e669ef6e297a4eea9c9f9c58ef9162eef1c66580c4156165c81371ff5832e56ad729d6ed3fb1459a14d682cfd2b8c37c9ceb298be2ef3 2 | -------------------------------------------------------------------------------- /_deps/checksums/gmp-6.0.0.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | 6ef5869ae735db9995619135bd856b84 2 | -------------------------------------------------------------------------------- /_deps/checksums/gmp-6.0.0.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 06bdd312146f77bd23d1447e60b02bfea2f1e6d00798b073879e8a50a6cf7264bdbf6f31a8347dd3a0889c7a9dee2d24051b74542fc4f9f07ba2d0f744e092ad 2 | -------------------------------------------------------------------------------- /_deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | 6217dae4a1016b37b12aeed1cc950187 2 | -------------------------------------------------------------------------------- /_deps/checksums/i686-4.9.2-release-win32-sjlj-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 1f38cc758725f124552285940cde6d9e072a594298a09f7a542a6cc28cb25d119d80d73918e4e9207694819825787abb6eba4a83cee5892e5acaf6350221b97f 2 | -------------------------------------------------------------------------------- /_deps/checksums/lapack-3.5.0.tgz/md5: -------------------------------------------------------------------------------- 1 | b1d3e3e425b2e44a06760ff173104bdf 2 | -------------------------------------------------------------------------------- /_deps/checksums/lapack-3.5.0.tgz/sha512: -------------------------------------------------------------------------------- 1 | b948a0a0db032bda455ec4f519d4e89e4c29e29cecb5b6258ca61f68faaeeac9fdf4ece5c39ffcd0154c5505facbc392c7d09c8348b1d60bdd2685153ab2543f 2 | -------------------------------------------------------------------------------- /_deps/checksums/libcxx-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 59006e659ffb33f5222a7b79d4cd071e 2 | -------------------------------------------------------------------------------- /_deps/checksums/libcxx-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 806ee0321ceac4d0bdcdad581208e8589d13f688124dfa75f484242fe299b8d423f6bd0172d674a01daf57b4f1e1a9751f5f331e734639917aa24f427b2f5e2c 2 | -------------------------------------------------------------------------------- /_deps/checksums/libgit2-f6dedf2c2eb806e2a6fdd4cf31f68386efc2ee0b.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 5ec6d4caf6218c27b73f7c00226de7aa 2 | -------------------------------------------------------------------------------- /_deps/checksums/libgit2-f6dedf2c2eb806e2a6fdd4cf31f68386efc2ee0b.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 76d85f5fce5c7a9ee142a7eb216253618845efd60962f2140865a2953faffc95d3855e5b87fd5cb1e0ef8d46cc93e9f51582adc60530ef1e86b0493013e16f49 2 | -------------------------------------------------------------------------------- /_deps/checksums/libosxunwind-0.0.1.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 8461714dc7f91bdb8fee5fa93e05f585 2 | -------------------------------------------------------------------------------- /_deps/checksums/libosxunwind-0.0.1.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | c253398bd5f81492192731727000547e86e9620247aef9463f2794cf33d9d4b11c13c99844d5234d9da12100bb755a73989256c84058b4e1356f42453b86c072 2 | -------------------------------------------------------------------------------- /_deps/checksums/libunwind-1.1.tar.gz/md5: -------------------------------------------------------------------------------- 1 | fb4ea2f6fbbe45bf032cd36e586883ce 2 | -------------------------------------------------------------------------------- /_deps/checksums/libunwind-1.1.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | bfe04f2bfac9f9e47c37f0b23ed2f264d8d3d3d6f1392fe9d794ee13cad216b3740979e922e4276fb65c1ccdc836fce48812cb5459ecdd2a89a621036a35d7c1 2 | -------------------------------------------------------------------------------- /_deps/checksums/libuv-9ab431a88fe255dd21e19a11f7fa2dd95774abf4.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 68b47fd2886292f14feb3a8de7446e1d 2 | -------------------------------------------------------------------------------- /_deps/checksums/libuv-9ab431a88fe255dd21e19a11f7fa2dd95774abf4.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 27bb21f3a7a663623245d50b9def2e73bc8ee47f13a74fcd83693a57651814790b5e8e0667e00ef45bfb4d41bb80943f6e143eec4a503f6a9a099e3804999e76 2 | -------------------------------------------------------------------------------- /_deps/checksums/lldb-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | c583c80c25e56a41e3e5ae7c2f442929 2 | -------------------------------------------------------------------------------- /_deps/checksums/lldb-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 73d24adb06a944244c2ad11f13711610fd54b5209afce7d0b7829439ec3bd0366cc2bac176b12defa5af73ab6115635022940c3eb176f448b45ea2402ecf2586 2 | -------------------------------------------------------------------------------- /_deps/checksums/lldb-3.5.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 9597d5376309805ac586adfbd1e992f4 2 | -------------------------------------------------------------------------------- /_deps/checksums/lldb-3.5.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | b3a45dd6b6c2d2d0e9909bc31d2bb3e19c63ae4e94c2a43db5a320a646a83d626d29ea1f45a0995123f9390f5db0c2b366e3a147e9a96cf454276a0a61a8497e 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3-i686-w64-mingw32-juliadeps.7z/md5: -------------------------------------------------------------------------------- 1 | e10c7a38c00bd79925c5ca60668cdc04 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3-i686-w64-mingw32-juliadeps.7z/sha512: -------------------------------------------------------------------------------- 1 | fea52f6b115767fea76fa501cf29e96922cba5a5738e21fd83ddf90754bacbdd811adb0579cdf3072b0165619c27097b957e3013cbb358c586c68cf8cf903622 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3-x86_64-w64-mingw32-juliadeps.7z/md5: -------------------------------------------------------------------------------- 1 | 311a181c91e3b176fe780e53bccbf445 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3-x86_64-w64-mingw32-juliadeps.7z/sha512: -------------------------------------------------------------------------------- 1 | 6c34119a4c162afd6425d90b950115eaf87abfce99186cf4a593c69562871e66941542992cdaf96cdcd78e2dda0656b8b0aa0d3682a06ae9bfdfa33607402366 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3.src.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 40564e1dc390f9844f1711c08b08e391 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.3.src.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.5.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | d6987305a1a0e58e128c1374cd3b8fef 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.5.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.5.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | 2d3d8004f38852aa679e5945b8ce0b14 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.5.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.6.0.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | f1e14e949f8df3047c59816c55278cec 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.6.0.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.6.1.src.tar.xz/md5: -------------------------------------------------------------------------------- 1 | ebf9e97be405ae126e134d3a357cd58a 2 | -------------------------------------------------------------------------------- /_deps/checksums/llvm-3.6.1.src.tar.xz/sha512: -------------------------------------------------------------------------------- 1 | fa07d0fe6c527d86c0b91b1b62597f949d777e3609e4e8ca2ea5e07931e1ebc7a363273cc705cf4a13b45e7ab00716b76de26688d077c1b51341d9dd2972de3f 2 | -------------------------------------------------------------------------------- /_deps/checksums/mpfr-3.1.2.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | ee2c3ac63bf0c2359bf08fc3ee094c19 2 | -------------------------------------------------------------------------------- /_deps/checksums/mpfr-3.1.2.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 0312a1ac813c51737e7d2b40fa771a73adb796ef962bbbd81ffd5e18a16b13346dd20875710e29f5304146750253d7d3755dc4c7b28c1b3b6cd527a6a7affd14 2 | -------------------------------------------------------------------------------- /_deps/checksums/openblas-53e849f4fcae4363a64576de00e982722c7304f9.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0d12e5bd5beb6a6948ea72efc3126264 2 | -------------------------------------------------------------------------------- /_deps/checksums/openblas-53e849f4fcae4363a64576de00e982722c7304f9.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 4bfbd7ed531138ec935346c0476a5ff857938c9e1e8090f71ed21fe6329a07b1b38577bfa1e5bfabfc397209c1b800aec315c5bfbe917229ec0dcf5a523ea688 2 | -------------------------------------------------------------------------------- /_deps/checksums/openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 0b45305ae6812bf17e866fbae5df7d57 2 | -------------------------------------------------------------------------------- /_deps/checksums/openlibm-3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | c6745389f6ee5bfc37d7055a49b6a13ae36e468c8ea387cf436fa0cbd97ba9aad0daf74941db24eebda831f78416905367ee006c45f8fe607fc9e8e460d11f9a 2 | -------------------------------------------------------------------------------- /_deps/checksums/openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz/md5: -------------------------------------------------------------------------------- 1 | f0b73590572edd8fa60d570aeba00631 2 | -------------------------------------------------------------------------------- /_deps/checksums/openspecfun-381db9bc865e51de67be9dcaa1610a6f90029c72.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3b593db9a1dbd30a5c4547e47f6ac450189f9ba7076c0061eb08ac6d7be9e5865862462cfddcc3c292ade8de3e87d8728d5b1be51f8337a10fa20fd303f88a5a 2 | -------------------------------------------------------------------------------- /_deps/checksums/patchelf-0.8.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 407b229e6a681ffb0e2cdd5915cb2d01 2 | -------------------------------------------------------------------------------- /_deps/checksums/patchelf-0.8.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | f8b8420d7b5fcdd9aa17f318cd7314024831e990d422b8e566c48ab009978a4c8c2cff4623b906aa50cf8805328b7c9ecb6ea1d65ed8a1e1d44db282249d92c9 2 | -------------------------------------------------------------------------------- /_deps/checksums/pcre2-10.20.tar.bz2/md5: -------------------------------------------------------------------------------- 1 | dcd027c57ecfdc8a6c3af9d0acf5e3f7 2 | -------------------------------------------------------------------------------- /_deps/checksums/pcre2-10.20.tar.bz2/sha512: -------------------------------------------------------------------------------- 1 | 3fcad35581a9d8e3b84b3509ada618165c0b53edb9622aa6ad92e83103eddabd6cfa8ce3aa9339bf5e0cf560b6f4ed07f37fcd3faa3b977964e610f23c99f639 2 | -------------------------------------------------------------------------------- /_deps/checksums/utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz/md5: -------------------------------------------------------------------------------- 1 | 9dab2320faeb9b7ca8623737b108a815 2 | -------------------------------------------------------------------------------- /_deps/checksums/utf8proc-85789180158ac7fff85b9f008828d6ac44f072ea.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | 3e0b7cb61d6fb8161d9890ed03485c445eee761ea228c4196af9fe190ca78ef9893f41f4a76ee2ecb49bcd42e69541cf6e763730970a130ab592e2956d1e8316 2 | -------------------------------------------------------------------------------- /_deps/checksums/virtualenv-1.11.6.tar.gz/md5: -------------------------------------------------------------------------------- 1 | f61cdd983d2c4e6aeabb70b1060d6f49 2 | -------------------------------------------------------------------------------- /_deps/checksums/virtualenv-1.11.6.tar.gz/sha512: -------------------------------------------------------------------------------- 1 | e0bb565495f5261a25ff68c4f553e9eeb8a0748bd707915d5a56ac841570012e6ab89f5647ec233745558903e6ddb516bac356d38f06a557f94d29475b0d6568 2 | -------------------------------------------------------------------------------- /_deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/md5: -------------------------------------------------------------------------------- 1 | b138576c92c425e8fa171a9d98e13b86 2 | -------------------------------------------------------------------------------- /_deps/checksums/x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z/sha512: -------------------------------------------------------------------------------- 1 | 50dcb3aaab3e53d5ff4561079272daf473bacc8d7a2a3720e7c594ae6e402123cb3cc6f3eabaf67df8d94fa5c01bb3e45b5bb1bc7cbb87cd2beb6b5664e02072 2 | -------------------------------------------------------------------------------- /_deps/dSFMT.c.patch: -------------------------------------------------------------------------------- 1 | --- dsfmt-2.2/dSFMT.c 2012-06-29 03:24:27.000000000 -0400 2 | +++ dSFMT-patched.c 2012-12-20 12:45:45.000000000 -0500 3 | @@ -32,13 +32,13 @@ 4 | inline static uint32_t ini_func1(uint32_t x); 5 | inline static uint32_t ini_func2(uint32_t x); 6 | inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array, 7 | - int size); 8 | + ptrdiff_t size); 9 | inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array, 10 | - int size); 11 | + ptrdiff_t size); 12 | inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array, 13 | - int size); 14 | + ptrdiff_t size); 15 | inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array, 16 | - int size); 17 | + ptrdiff_t size); 18 | inline static int idxof(int i); 19 | static void initial_mask(dsfmt_t *dsfmt); 20 | static void period_certification(dsfmt_t *dsfmt); 21 | @@ -142,8 +142,8 @@ 22 | * @param size number of 128-bit pseudorandom numbers to be generated. 23 | */ 24 | inline static void gen_rand_array_c1o2(dsfmt_t *dsfmt, w128_t *array, 25 | - int size) { 26 | - int i, j; 27 | + ptrdiff_t size) { 28 | + ptrdiff_t i, j; 29 | w128_t lung; 30 | 31 | lung = dsfmt->status[DSFMT_N]; 32 | @@ -180,8 +180,8 @@ 33 | * @param size number of 128-bit pseudorandom numbers to be generated. 34 | */ 35 | inline static void gen_rand_array_c0o1(dsfmt_t *dsfmt, w128_t *array, 36 | - int size) { 37 | - int i, j; 38 | + ptrdiff_t size) { 39 | + ptrdiff_t i, j; 40 | w128_t lung; 41 | 42 | lung = dsfmt->status[DSFMT_N]; 43 | @@ -223,8 +223,8 @@ 44 | * @param size number of 128-bit pseudorandom numbers to be generated. 45 | */ 46 | inline static void gen_rand_array_o0o1(dsfmt_t *dsfmt, w128_t *array, 47 | - int size) { 48 | - int i, j; 49 | + ptrdiff_t size) { 50 | + ptrdiff_t i, j; 51 | w128_t lung; 52 | 53 | lung = dsfmt->status[DSFMT_N]; 54 | @@ -266,8 +266,8 @@ 55 | * @param size number of 128-bit pseudorandom numbers to be generated. 56 | */ 57 | inline static void gen_rand_array_o0c1(dsfmt_t *dsfmt, w128_t *array, 58 | - int size) { 59 | - int i, j; 60 | + ptrdiff_t size) { 61 | + ptrdiff_t i, j; 62 | w128_t lung; 63 | 64 | lung = dsfmt->status[DSFMT_N]; 65 | @@ -453,7 +453,7 @@ 66 | * memory. Mac OSX doesn't have these functions, but \b malloc of OSX 67 | * returns the pointer to the aligned memory block. 68 | */ 69 | -void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], int size) { 70 | +void dsfmt_fill_array_close1_open2(dsfmt_t *dsfmt, double array[], ptrdiff_t size) { 71 | assert(size % 2 == 0); 72 | assert(size >= DSFMT_N64); 73 | gen_rand_array_c1o2(dsfmt, (w128_t *)array, size / 2); 74 | @@ -471,7 +471,7 @@ 75 | * @param size the number of pseudorandom numbers to be generated. 76 | * see also \sa fill_array_close1_open2() 77 | */ 78 | -void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], int size) { 79 | +void dsfmt_fill_array_open_close(dsfmt_t *dsfmt, double array[], ptrdiff_t size) { 80 | assert(size % 2 == 0); 81 | assert(size >= DSFMT_N64); 82 | gen_rand_array_o0c1(dsfmt, (w128_t *)array, size / 2); 83 | @@ -489,7 +489,7 @@ 84 | * @param size the number of pseudorandom numbers to be generated. 85 | * see also \sa fill_array_close1_open2() 86 | */ 87 | -void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], int size) { 88 | +void dsfmt_fill_array_close_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size) { 89 | assert(size % 2 == 0); 90 | assert(size >= DSFMT_N64); 91 | gen_rand_array_c0o1(dsfmt, (w128_t *)array, size / 2); 92 | @@ -507,7 +507,7 @@ 93 | * @param size the number of pseudorandom numbers to be generated. 94 | * see also \sa fill_array_close1_open2() 95 | */ 96 | -void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], int size) { 97 | +void dsfmt_fill_array_open_open(dsfmt_t *dsfmt, double array[], ptrdiff_t size) { 98 | assert(size % 2 == 0); 99 | assert(size >= DSFMT_N64); 100 | gen_rand_array_o0o1(dsfmt, (w128_t *)array, size / 2); 101 | -------------------------------------------------------------------------------- /_deps/find_python2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # LLVM requires 2.5 <= python2 < 3 4 | # 5 | 6 | valid_python() { 7 | $1 -c 'import sys; sys.exit(not (sys.version_info >= (2,5) and sys.version_info < (3,0)))' 2> /dev/null 8 | } 9 | 10 | for python in python python2 python2.7 python27 python2.6 python26 python2.5 python25; do 11 | if valid_python $python; then 12 | echo `which $python` 13 | break 14 | fi 15 | done 16 | 17 | -------------------------------------------------------------------------------- /_deps/gfortblas.alias: -------------------------------------------------------------------------------- 1 | _sasum_ _sasum 2 | _sasum_ _SASUM 3 | _sasum_ _SASUM_ 4 | _sasum_ _sasum_gfort_ 5 | 6 | _scasum_ _scasum 7 | _scasum_ _SCASUM 8 | _scasum_ _SCASUM_ 9 | _scasum_ _scasum_gfort_ 10 | 11 | _scnrm2_ _scnrm2 12 | _scnrm2_ _SCNRM2 13 | _scnrm2_ _SCNRM2_ 14 | _scnrm2_ _scnrm2_gfort_ 15 | 16 | _sdot_ _sdot 17 | _sdot_ _SDOT 18 | _sdot_ _SDOT_ 19 | _sdot_ _sdot_gfort_ 20 | 21 | _sdsdot_ _sdsdot 22 | _sdsdot_ _SDSDOT 23 | _sdsdot_ _SDSDOT_ 24 | _sdsdot_ _sdsdot_gfort_ 25 | 26 | _snrm2_ _snrm2 27 | _snrm2_ _SNRM2 28 | _snrm2_ _SNRM2_ 29 | _snrm2_ _snrm2_gfort_ 30 | 31 | 32 | _cdotc_ _cdotc 33 | _cdotc_ _CDOTC 34 | _cdotc_ _CDOTC_ 35 | _cdotc_ _cdotc_gfort_ 36 | 37 | _cdotu_ _cdotu 38 | _cdotu_ _CDOTU 39 | _cdotu_ _CDOTU_ 40 | _cdotu_ _cdotu_gfort_ 41 | 42 | _zdotc_ _zdotc 43 | _zdotc_ _ZDOTC 44 | _zdotc_ _ZDOTC_ 45 | _zdotc_ _zdotc_gfort_ 46 | 47 | _zdotu_ _zdotu 48 | _zdotu_ _ZDOTU 49 | _zdotu_ _ZDOTU_ 50 | _zdotu_ _zdotu_gfort_ 51 | -------------------------------------------------------------------------------- /_deps/gfortblas.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) 2013 JuliaLang Project / Jameson Nash 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * 24 | * Inspired by blaswrap.c by Jarno Rajahalme 2011 (written for Octave) 25 | * 26 | * Wrapper for Apple libBLAS.dylib for the gfortran calling convention 27 | * 28 | * At least on the versions of OSX 10.6 so far (up and including 10.6.6) 29 | * these libraries are incompatible with 64 bit builds, as some functions 30 | * in libBLAS.dylib are not conforming to F2C calling conventions, as 31 | * they should. This breaks them in 64-bit builds on the x86_64 32 | * architecture. 33 | * 34 | * Newer gfortran compoilers no longer default to the F2C calling 35 | * convention. These wrappers map the F2C conformant functions in 36 | * libBLAS and libLAPACK to the native gfortran calling convention, so 37 | * that the libraries can be used with software built for x86_64 38 | * architecture. 39 | * 40 | * These wrappers are as efficient as the Apple functions of the same name. 41 | **/ 42 | 43 | #include 44 | #include 45 | 46 | float sasum_(int *N, float *SX, int *INCX) { 47 | return cblas_sasum(*N, SX, *INCX); 48 | } 49 | float scasum_(int *N, void *SX, int *INCX) { 50 | return cblas_scasum(*N, SX, *INCX); 51 | } 52 | float scnrm2_(int *N, void *X, int *INCX) { 53 | return cblas_scnrm2(*N, X, *INCX); 54 | } 55 | float sdot_(int *N, float *SX, int *INCX, float *SY, int *INCY) { 56 | return cblas_sdot(*N, SX, *INCX, SY, *INCY); 57 | } 58 | float sdsdot_(int *N, float *SB, float *SX, int *INCX, float *SY, int *INCY) { 59 | return cblas_sdsdot(*N, *SB, SX, *INCX, SY, *INCY); 60 | } 61 | float snrm2_(int *N, float *X, int *INCX) { 62 | return cblas_snrm2(*N, X, *INCX); 63 | } 64 | /* 65 | float scabs1_(void *Z) { 66 | this function is part of BLAS spec, but is not provided by Apple nor required by LAPACK 67 | } 68 | */ 69 | 70 | complex float cdotc_(int *N, void *CX, int *INCX, void *CY, int *INCY) { 71 | complex float dotc; 72 | cblas_cdotc_sub(*N, CX, *INCX, CY, *INCY, &dotc); 73 | return dotc; 74 | } 75 | complex float cdotu_(int *N, void *CX, int *INCX, void *CY, int *INCY) { 76 | complex float dotu; 77 | cblas_cdotu_sub(*N, CX, *INCX, CY, *INCY, &dotu); 78 | return dotu; 79 | } 80 | complex double zdotc_(int *N, void *CX, int *INCX, void *CY, int *INCY) { 81 | complex double dotc; 82 | cblas_zdotc_sub(*N, CX, *INCX, CY, *INCY, &dotc); 83 | return dotc; 84 | } 85 | complex double zdotu_(int *N, void *CX, int *INCX, void *CY, int *INCY) { 86 | complex double dotu; 87 | cblas_zdotu_sub(*N, CX, *INCX, CY, *INCY, &dotu); 88 | return dotu; 89 | } 90 | 91 | //#include 92 | //#include 93 | //extern void xerbl2_(const char*, const int*) __attribute__((weak)); 94 | void BLASParamErrorProcNULL( 95 | const char *funcName, 96 | const char *paramName, 97 | const int *paramPos, 98 | const int *paramValue) { 99 | // //cblas_xerbla(*paramPos, (char*)funcName, " param %s\n", paramName); 100 | // if (funcName && !strncmp(funcName, "cblas_", 6)) funcName += 6; 101 | // size_t i, len = strlen(funcName); 102 | // char funcName2[7]; 103 | // for (i = 0; i < len; i++) 104 | // funcName2[i] = toupper(funcName[i]); 105 | // for (i = len; i < 6; i++) 106 | // funcName2[i] = ' '; 107 | // funcName2[i] = 0; 108 | // int paramPos2 = *paramPos-1; 109 | // if (xerbl2_) xerbl2_(funcName2, ¶mPos2); 110 | /* default BLAS error handler calls abort() on invalid parameters, but we want to handle these failures in Julia */ 111 | } 112 | 113 | __attribute__((constructor)) 114 | static void init(void) { 115 | SetBLASParamErrorProc(BLASParamErrorProcNULL); 116 | } 117 | 118 | __attribute__((destructor)) 119 | static void fini(void) { 120 | SetBLASParamErrorProc(NULL); /* restore default handler */ 121 | } 122 | 123 | -------------------------------------------------------------------------------- /_deps/gmp_6.0.0_osx.patch: -------------------------------------------------------------------------------- 1 | diff -r db645603dcdb -r 1fab0adc5ff7 mpn/x86_64/k8/redc_1.asm 2 | --- a/mpn/x86_64/k8/redc_1.asm Mon Mar 31 23:04:32 2014 +0200 3 | +++ b/mpn/x86_64/k8/redc_1.asm Wed Apr 02 22:28:24 2014 +0200 4 | @@ -114,7 +114,7 @@ 5 | 6 | JUMPTABSECT 7 | ALIGN(8) 8 | -L(tab): JMPENT( L(0m4), L(tab)) 9 | +L(tab): JMPENT( L(0), L(tab)) 10 | JMPENT( L(1), L(tab)) 11 | JMPENT( L(2), L(tab)) 12 | JMPENT( L(3), L(tab)) 13 | @@ -397,6 +397,7 @@ 14 | 15 | 16 | ALIGN(16) 17 | +L(0): 18 | L(0m4): 19 | L(lo0): mov (mp,nneg,8), %rax 20 | mov nneg, i 21 | 22 | -------------------------------------------------------------------------------- /_deps/instcombine-llvm-3.3.patch: -------------------------------------------------------------------------------- 1 | diff -u -r -N llvm-3.3.src/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp llvm-3.3/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2 | --- llvm-3.3.src/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2013-01-02 06:36:10.000000000 -0500 3 | +++ llvm-3.3/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 2014-06-18 23:11:49.000000000 -0400 4 | @@ -754,7 +754,7 @@ 5 | ComputeMaskedBits(I->getOperand(0), LHSKnownZero, LHSKnownOne, Depth+1); 6 | // If it's known zero, our sign bit is also zero. 7 | if (LHSKnownZero.isNegative()) 8 | - KnownZero |= LHSKnownZero; 9 | + KnownZero.setBit(KnownZero.getBitWidth() - 1); 10 | } 11 | break; 12 | case Instruction::URem: { 13 | -------------------------------------------------------------------------------- /_deps/int128-vector.llvm-3.3.patch: -------------------------------------------------------------------------------- 1 | diff -u -r -N llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeTypes.h 2 | --- llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeTypes.h 2013-04-21 19:47:41.000000000 -0400 3 | +++ llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeTypes.h 2014-08-08 01:48:48.000000000 -0400 4 | @@ -561,6 +561,7 @@ 5 | void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 6 | void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi); 7 | void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 8 | + void SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 9 | void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi); 10 | void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); 11 | void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi); 12 | diff -u -r -N llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeTypes.h.rej llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeTypes.h.rej 13 | --- llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeTypes.h.rej 1969-12-31 19:00:00.000000000 -0500 14 | +++ llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeTypes.h.rej 2014-08-08 02:10:36.000000000 -0400 15 | @@ -0,0 +1,16 @@ 16 | +*************** 17 | +*** 561,566 **** 18 | + void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 19 | + void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi); 20 | + void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 21 | + void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi); 22 | + void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); 23 | + void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi); 24 | +--- 561,567 ---- 25 | + void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 26 | + void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi); 27 | + void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 28 | ++ void SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, SDValue &Hi); 29 | + void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi); 30 | + void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi); 31 | + void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi); 32 | diff -u -r -N llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp 33 | --- llvm-3.3.src/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp 2013-04-21 19:47:41.000000000 -0400 34 | +++ llvm-3.3/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp 2014-08-08 02:13:03.000000000 -0400 35 | @@ -501,6 +501,7 @@ 36 | case ISD::BUILD_VECTOR: SplitVecRes_BUILD_VECTOR(N, Lo, Hi); break; 37 | case ISD::CONCAT_VECTORS: SplitVecRes_CONCAT_VECTORS(N, Lo, Hi); break; 38 | case ISD::EXTRACT_SUBVECTOR: SplitVecRes_EXTRACT_SUBVECTOR(N, Lo, Hi); break; 39 | + case ISD::INSERT_SUBVECTOR: SplitVecRes_INSERT_SUBVECTOR(N, Lo, Hi); break; 40 | case ISD::FP_ROUND_INREG: SplitVecRes_InregOp(N, Lo, Hi); break; 41 | case ISD::FPOWI: SplitVecRes_FPOWI(N, Lo, Hi); break; 42 | case ISD::INSERT_VECTOR_ELT: SplitVecRes_INSERT_VECTOR_ELT(N, Lo, Hi); break; 43 | @@ -714,6 +715,43 @@ 44 | DAG.getIntPtrConstant(IdxVal + LoVT.getVectorNumElements())); 45 | } 46 | 47 | +void DAGTypeLegalizer::SplitVecRes_INSERT_SUBVECTOR(SDNode *N, SDValue &Lo, 48 | + SDValue &Hi) { 49 | + SDValue Vec = N->getOperand(0); 50 | + SDValue SubVec = N->getOperand(1); 51 | + SDValue Idx = N->getOperand(2); 52 | + DebugLoc dl = N->getDebugLoc(); 53 | + GetSplitVector(Vec, Lo, Hi); 54 | + 55 | + // Spill the vector to the stack. 56 | + EVT VecVT = Vec.getValueType(); 57 | + EVT SubVecVT = VecVT.getVectorElementType(); 58 | + SDValue StackPtr = DAG.CreateStackTemporary(VecVT); 59 | + SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, 60 | + MachinePointerInfo(), false, false, 0); 61 | + 62 | + // Store the new subvector into the specified index. 63 | + SDValue SubVecPtr = GetVectorElementPointer(StackPtr, SubVecVT, Idx); 64 | + Type *VecType = VecVT.getTypeForEVT(*DAG.getContext()); 65 | + unsigned Alignment = TLI.getDataLayout()->getPrefTypeAlignment(VecType); 66 | + Store = DAG.getStore(Store, dl, SubVec, SubVecPtr, MachinePointerInfo(), 67 | + false, false, 0); 68 | + 69 | + // Load the Lo part from the stack slot. 70 | + Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), 71 | + false, false, false, 0); 72 | + 73 | + // Increment the pointer to the other part. 74 | + unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8; 75 | + StackPtr = 76 | + DAG.getNode(ISD::ADD, dl, StackPtr.getValueType(), StackPtr, 77 | + DAG.getConstant(IncrementSize, StackPtr.getValueType())); 78 | + 79 | + // Load the Hi part from the stack slot. 80 | + Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, MachinePointerInfo(), 81 | + false, false, false, MinAlign(Alignment, IncrementSize)); 82 | +} 83 | + 84 | void DAGTypeLegalizer::SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, 85 | SDValue &Hi) { 86 | DebugLoc dl = N->getDebugLoc(); 87 | -------------------------------------------------------------------------------- /_deps/jlchecksum: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # usage: jlchecksum 4 | # 5 | 6 | if [ -z "$1" ]; then 7 | echo "Usage: ./jlchecksum " >&2 8 | exit 1 9 | fi 10 | 11 | # Get the directory of this script 12 | DIR="$( cd "$( dirname "$0" )" && pwd )" 13 | 14 | # Get the basename of the file we're trying to checksum 15 | BASENAME=$(basename $1) 16 | 17 | # Print out a hash, and wrap around if we're longer than 64 characters 18 | print_hash() 19 | { 20 | if [ ${#1} -gt 64 ]; then 21 | NUM_LINES=$(( (${#1} + 63) / 64)) 22 | for i in `seq 0 1 $((NUM_LINES - 1))`; do 23 | str_piece=$(echo "$1" | awk "{ string=substr(\$0, $((i*64 + 1)), $(((i+1)*64))); print string; }") 24 | echo " $str_piece" 25 | done 26 | else 27 | echo " $1" >&2 28 | fi 29 | } 30 | 31 | checksum_error() 32 | { 33 | echo "===============================================================================" >&2 34 | echo " ERROR: $CHECKSUM_TYPE checksum failure on $BASENAME, should be:" >&2 35 | print_hash "$TRUE_CHECKSUM" 36 | echo " But \`$CHECKSUM_PROG\` results in:" >&2 37 | print_hash "$CURR_CHECKSUM" 38 | echo " This can happen due to bad downloads or network proxies, please check your" >&2 39 | echo " network proxy/firewall settings and delete deps/$BASENAME" >&2 40 | echo " to force a redownload when you are ready" >&2 41 | echo "===============================================================================" >&2 42 | exit 2 43 | } 44 | 45 | find_checksum() 46 | { 47 | if [ ! -f "$DIR/checksums/$BASENAME/$CHECKSUM_TYPE" ]; then 48 | echo "WARNING: $CHECKSUM_TYPE checksum for $BASENAME not found in deps/checksums/, autogenerating..." >&2 49 | 50 | # Generate as many checksum types as we can 51 | mkdir -p "$DIR/checksums/$BASENAME" 52 | if [ ! -z "$MD5_PROG" ]; then 53 | echo $(eval $MD5_PROG) > "$DIR/checksums/$BASENAME/md5" 54 | fi 55 | if [ ! -z "$SHA512_PROG" ]; then 56 | echo $(eval $SHA512_PROG) > "$DIR/checksums/$BASENAME/sha512" 57 | fi 58 | fi 59 | 60 | TRUE_CHECKSUM=$(cat "$DIR/checksums/$BASENAME/$CHECKSUM_TYPE") 61 | } 62 | 63 | # These are the programs we run to hash a file 64 | SHA512_PROG="" 65 | MD5_PROG="" 66 | find_checksum_progs() 67 | { 68 | if [ ! -z $(which sha512sum) ]; then 69 | SHA512_PROG="sha512sum $BASENAME | awk '{ print \$1; }'" 70 | elif [ ! -z $(which shasum) ]; then 71 | SHA512_PROG="shasum -a 512 $BASENAME | awk '{ print \$1; }'" 72 | fi 73 | 74 | if [ ! -z $(which md5sum) ]; then 75 | MD5_PROG="md5sum $BASENAME | awk '{ print \$1; }'" 76 | elif [ ! -z $(which md5) ]; then 77 | MD5_PROG="md5 -q $BASENAME" 78 | fi 79 | } 80 | 81 | 82 | # Search for checksum programs and store them into SHA512_PROG, MD5_PROG, etc... 83 | find_checksum_progs 84 | 85 | # Choose final checksumming program, preferring SHA512 over MD5 86 | if [ ! -z "$SHA512_PROG" ]; then 87 | CHECKSUM_TYPE="sha512" 88 | CHECKSUM_PROG=$SHA512_PROG 89 | elif [ ! -z "$MD5_PROG" ]; then 90 | CHECKSUM_TYPE="md5" 91 | CHECKSUM_PROG=$MD5_PROG 92 | else 93 | echo "WARNING: No checksumming programs found, cannot verify downloads" >&2 94 | exit 0 95 | fi 96 | 97 | # Find true checksum 98 | find_checksum "$CHECKSUM_TYPE" 99 | 100 | # Calculate actual checksum 101 | CURR_CHECKSUM=$(eval $CHECKSUM_PROG) 102 | 103 | # Make sure they're the same. If not, error out! 104 | if [ "$TRUE_CHECKSUM" != "$CURR_CHECKSUM" ]; then 105 | checksum_error 106 | fi 107 | -------------------------------------------------------------------------------- /_deps/jldownload: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # usage: jldownload [] 4 | # 5 | 6 | CACHE_HOST=https://cache.e.ip.saba.us 7 | 8 | WGET=$(which wget 2>/dev/null) 9 | CURL=$(which curl 2>/dev/null) 10 | FETCH=$(which fetch 2>/dev/null) 11 | 12 | TIMEOUT=15 # seconds 13 | WGET_OPTS="--no-check-certificate --tries=1 --timeout=$TIMEOUT" 14 | CURL_OPTS="-fkL --connect-timeout $TIMEOUT -y $TIMEOUT" 15 | FETCH_OPTS="-T $TIMEOUT" 16 | 17 | if [ $# -eq 1 ]; then 18 | CURL_OPTS="$CURL_OPTS -O" 19 | URL=$1 20 | elif [ $# -eq 2 ]; then 21 | WGET_OPTS="$WGET_OPTS -O $1" 22 | CURL_OPTS="$CURL_OPTS -o $1" 23 | FETCH_OPTS="$FETCH_OPTS -o $1" 24 | URL=$2 25 | else 26 | exit 1 27 | fi 28 | 29 | CACHE_URL="$CACHE_HOST/$URL" 30 | 31 | if [ -x "$CURL" ] && $CURL -V >/dev/null; then 32 | GETURL="$CURL $CURL_OPTS" 33 | elif [ -x "$WGET" ] && $WGET -V >/dev/null; then 34 | GETURL="$WGET $WGET_OPTS" 35 | elif [ -x "$FETCH" ]; then 36 | GETURL="$FETCH $FETCH_OPTS" 37 | else 38 | echo "Could not find working curl, wget, or fetch." 39 | echo "You need to install one of these to download dependencies." 40 | exit 1 41 | fi 42 | 43 | # Try to get from the cache if it is possible. Note that the cache will 44 | # forward to the original URL if it has not cached this download yet, or 45 | # if the URL is not cacheable. We fallback to directly querying the 46 | # uncached URL to protect against cache service downtime 47 | $GETURL $CACHE_URL || $GETURL $URL 48 | -------------------------------------------------------------------------------- /_deps/libdSFMT.def: -------------------------------------------------------------------------------- 1 | LIBRARY "libdSFMT.dll" 2 | EXPORTS 3 | dsfmt_chk_init_by_array 4 | dsfmt_chk_init_gen_rand 5 | dsfmt_fill_array_close1_open2 6 | dsfmt_fill_array_close_open 7 | dsfmt_fill_array_open_close 8 | dsfmt_fill_array_open_open 9 | dsfmt_gen_rand_all 10 | dsfmt_genrand_close1_open2 11 | dsfmt_genrand_close_open 12 | dsfmt_genrand_open_close 13 | dsfmt_genrand_open_open 14 | dsfmt_genrand_uint32 15 | dsfmt_get_idstring 16 | dsfmt_get_min_array_size 17 | dsfmt_global_data DATA 18 | dsfmt_gv_fill_array_close1_open2 19 | dsfmt_gv_fill_array_close_open 20 | dsfmt_gv_fill_array_open_close 21 | dsfmt_gv_fill_array_open_open 22 | dsfmt_gv_genrand_close1_open2 23 | dsfmt_gv_genrand_close_open 24 | dsfmt_gv_genrand_open_close 25 | dsfmt_gv_genrand_open_open 26 | dsfmt_gv_genrand_uint32 27 | dsfmt_gv_init_by_array 28 | dsfmt_gv_init_gen_rand 29 | dsfmt_init_by_array 30 | dsfmt_init_gen_rand 31 | -------------------------------------------------------------------------------- /_deps/libgit2.version: -------------------------------------------------------------------------------- 1 | LIBGIT2_BRANCH=v0.23.1 2 | LIBGIT2_SHA1=f6dedf2c2eb806e2a6fdd4cf31f68386efc2ee0b 3 | -------------------------------------------------------------------------------- /_deps/libunwind.patch: -------------------------------------------------------------------------------- 1 | From e1d7c78d95e4b73a311f10149d0a54547d307d5d Mon Sep 17 00:00:00 2001 2 | From: Kevin Modzelewski 3 | Date: Tue, 22 Apr 2014 15:50:40 -0700 4 | Subject: [PATCH] Change the RBP-validation heuristic to allow size-0 call frames 5 | 6 | --- 7 | diff --git a/src/x86_64/Gstep.c b/src/x86_64/Gstep.c 8 | index 9fa0967..809d60b 100644 9 | --- a/src/x86_64/Gstep.c 10 | +++ b/src/x86_64/Gstep.c 11 | @@ -173,7 +173,7 @@ unw_step (unw_cursor_t *cursor) 12 | anything about new RBP (rbp1) since it may not be a frame 13 | pointer in the frame above. Just check we get the value. */ 14 | if (ret < 0 15 | - || rbp <= c->dwarf.cfa 16 | + || rbp < c->dwarf.cfa 17 | || (rbp - c->dwarf.cfa) > 0x4000) 18 | { 19 | rip_loc = DWARF_NULL_LOC; 20 | -- 21 | 1.7.4.1 22 | 23 | -------------------------------------------------------------------------------- /_deps/libuv.version: -------------------------------------------------------------------------------- 1 | LIBUV_BRANCH=julia0.4-uv0.11.26 2 | LIBUV_SHA1=9ab431a88fe255dd21e19a11f7fa2dd95774abf4 3 | -------------------------------------------------------------------------------- /_deps/openblas.version: -------------------------------------------------------------------------------- 1 | OPENBLAS_BRANCH=v0.2.15 2 | OPENBLAS_SHA1=53e849f4fcae4363a64576de00e982722c7304f9 3 | -------------------------------------------------------------------------------- /_deps/openlibm.version: -------------------------------------------------------------------------------- 1 | OPENLIBM_BRANCH=v0.4.1 2 | OPENLIBM_SHA1=3ee2a6e6a9fc68cbf2ab00f830b9059215e40b06 3 | -------------------------------------------------------------------------------- /_deps/openspecfun.version: -------------------------------------------------------------------------------- 1 | OPENSPECFUN_BRANCH=master 2 | OPENSPECFUN_SHA1=381db9bc865e51de67be9dcaa1610a6f90029c72 3 | -------------------------------------------------------------------------------- /_deps/osx-10.10.llvm-3.3.patch: -------------------------------------------------------------------------------- 1 | --- Makefile.rules.old 2014-07-29 12:01:50.000000000 +0530 2 | +++ Makefile.rules 2014-07-29 12:02:10.000000000 +0530 3 | @@ -571,9 +571,9 @@ ifeq ($(HOST_OS),Darwin) 4 | DARWIN_VERSION := `sw_vers -productVersion` 5 | endif 6 | # Strip a number like 10.4.7 to 10.4 7 | - DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/') 8 | + DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/') 9 | # Get "4" out of 10.4 for later pieces in the makefile. 10 | - DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/') 11 | + DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/') 12 | 13 | LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress 14 | SharedLinkOptions := -dynamiclib 15 | -------------------------------------------------------------------------------- /_deps/utf8proc.version: -------------------------------------------------------------------------------- 1 | UTF8PROC_BRANCH=v1.3 2 | UTF8PROC_SHA1=85789180158ac7fff85b9f008828d6ac44f072ea 3 | -------------------------------------------------------------------------------- /_deps/zerosign-llvm-3.6.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp 2 | index 4a85780..73a1f25 100644 3 | --- a/lib/Transforms/Scalar/GVN.cpp 4 | +++ b/lib/Transforms/Scalar/GVN.cpp 5 | @@ -2182,12 +2182,16 @@ bool GVN::propagateEquality(Value *LHS, Value *RHS, 6 | // Handle the floating point versions of equality comparisons too. 7 | if ((isKnownTrue && Cmp->getPredicate() == CmpInst::FCMP_OEQ) || 8 | (isKnownFalse && Cmp->getPredicate() == CmpInst::FCMP_UNE)) { 9 | - // Floating point -0.0 and 0.0 compare equal, so we can't 10 | - // propagate a constant based on that comparison. 11 | + 12 | + // Floating point -0.0 and 0.0 compare equal, so we can only 13 | + // propagate values if we know that we have a constant and that 14 | + // its value is non-zero. 15 | + 16 | // FIXME: We should do this optimization if 'no signed zeros' is 17 | // applicable via an instruction-level fast-math-flag or some other 18 | // indicator that relaxed FP semantics are being used. 19 | - if (!isa(Op1) || !cast(Op1)->isZero()) 20 | + 21 | + if (isa(Op1) && !cast(Op1)->isZero()) 22 | Worklist.push_back(std::make_pair(Op0, Op1)); 23 | } 24 | 25 | diff --git a/test/Transforms/GVN/edge.ll b/test/Transforms/GVN/edge.ll 26 | index f28a76b..0c1a3fb 100644 27 | --- a/test/Transforms/GVN/edge.ll 28 | +++ b/test/Transforms/GVN/edge.ll 29 | @@ -59,7 +59,7 @@ bb2: 30 | ret void 31 | } 32 | 33 | -define double @fcmp_oeq(double %x, double %y) { 34 | +define double @fcmp_oeq_not_zero(double %x, double %y) { 35 | entry: 36 | %cmp = fcmp oeq double %y, 2.0 37 | br i1 %cmp, label %if, label %return 38 | @@ -72,11 +72,11 @@ return: 39 | %retval = phi double [ %div, %if ], [ %x, %entry ] 40 | ret double %retval 41 | 42 | -; CHECK-LABEL: define double @fcmp_oeq( 43 | +; CHECK-LABEL: define double @fcmp_oeq_not_zero( 44 | ; CHECK: %div = fdiv double %x, 2.0 45 | } 46 | 47 | -define double @fcmp_une(double %x, double %y) { 48 | +define double @fcmp_une_not_zero(double %x, double %y) { 49 | entry: 50 | %cmp = fcmp une double %y, 2.0 51 | br i1 %cmp, label %return, label %else 52 | @@ -89,7 +89,7 @@ return: 53 | %retval = phi double [ %div, %else ], [ %x, %entry ] 54 | ret double %retval 55 | 56 | -; CHECK-LABEL: define double @fcmp_une( 57 | +; CHECK-LABEL: define double @fcmp_une_not_zero( 58 | ; CHECK: %div = fdiv double %x, 2.0 59 | } 60 | 61 | @@ -129,3 +129,42 @@ return: 62 | ; CHECK-LABEL: define double @fcmp_une_zero( 63 | ; CHECK: %div = fdiv double %x, %y 64 | } 65 | + 66 | +; We also cannot propagate a value if it's not a constant. 67 | +; This is because the value could be 0.0 or -0.0. 68 | + 69 | +define double @fcmp_oeq_maybe_zero(double %x, double %y, double %z1, double %z2) { 70 | +entry: 71 | + %z = fadd double %z1, %z2 72 | + %cmp = fcmp oeq double %y, %z 73 | + br i1 %cmp, label %if, label %return 74 | + 75 | +if: 76 | + %div = fdiv double %x, %z 77 | + br label %return 78 | + 79 | +return: 80 | + %retval = phi double [ %div, %if ], [ %x, %entry ] 81 | + ret double %retval 82 | + 83 | +; CHECK-LABEL: define double @fcmp_oeq_maybe_zero( 84 | +; CHECK: %div = fdiv double %x, %z 85 | +} 86 | + 87 | +define double @fcmp_une_maybe_zero(double %x, double %y, double %z1, double %z2) { 88 | +entry: 89 | + %z = fadd double %z1, %z2 90 | + %cmp = fcmp une double %y, %z 91 | + br i1 %cmp, label %return, label %else 92 | + 93 | +else: 94 | + %div = fdiv double %x, %z 95 | + br label %return 96 | + 97 | +return: 98 | + %retval = phi double [ %div, %else ], [ %x, %entry ] 99 | + ret double %retval 100 | + 101 | +; CHECK-LABEL: define double @fcmp_une_maybe_zero( 102 | +; CHECK: %div = fdiv double %x, %z 103 | +} 104 | -------------------------------------------------------------------------------- /_original/README.md: -------------------------------------------------------------------------------- 1 | Original version the translation is based on. 2 | 3 | Copied from release-0.4 branch, commit adffe19dfb704444789429bffa51f4e05b386125 . 4 | 5 | 翻訳が”底本”とする英語版のドキュメント。 6 | 7 | -------------------------------------------------------------------------------- /_original/devdocs/C.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-c-index: 4 | 5 | ##################################### 6 | Developing/debugging Julia's C code 7 | ##################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | backtraces 13 | debuggingtips 14 | valgrind 15 | -------------------------------------------------------------------------------- /_original/devdocs/backtraces.rst: -------------------------------------------------------------------------------- 1 | ******************************************* 2 | Reporting and analyzing crashes (segfaults) 3 | ******************************************* 4 | 5 | So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected. 6 | 7 | If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms: 8 | 9 | * `Segfaults during bootstrap (sysimg.jl)`_ 10 | 11 | * `Segfaults when running a script`_ 12 | 13 | * `Errors during julia startup`_ 14 | 15 | .. _version info: 16 | 17 | Version/Environment info 18 | ------------------------ 19 | 20 | No matter the error, we will always need to know what version of julia you are running. When julia first starts up, a header is printed out with a version number and date. If your version is ``0.2.0`` or higher, please include the output of ``versioninfo()`` in any report you create:: 21 | 22 | julia> versioninfo() 23 | Julia Version 0.3.3-pre+25 24 | Commit 417b50a* (2014-11-03 11:32 UTC) 25 | Platform Info: 26 | System: Linux (x86_64-linux-gnu) 27 | CPU: Intel(R) Core(TM) i7 CPU L 640 @ 2.13GHz 28 | WORD_SIZE: 64 29 | BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem) 30 | LAPACK: libopenblas 31 | LIBM: libopenlibm 32 | LLVM: libLLVM-3.3 33 | 34 | 35 | .. _Segfaults during bootstrap (sysimg.jl): 36 | 37 | Segfaults during bootstrap (sysimg.jl) 38 | -------------------------------------- 39 | 40 | Segfaults toward the end of the ``make`` process of building julia are a common symptom of something going wrong while julia is preparsing the corpus of code in the ``base/`` folder. Many factors can contribute toward this process dying unexpectedly, however it is as often as not due to an error in the C-code portion of julia, and as such must typically be debugged with a debug build inside of ``gdb``. Explicitly: 41 | 42 | Create a debug build of julia:: 43 | 44 | $ cd 45 | $ make debug 46 | 47 | Note that this process will likely fail with the same error as a normal ``make`` incantation, however this will create a debug executable that will offer ``gdb`` the debugging symbols needed to get accurate backtraces. Next, manually run the bootstrap process inside of ``gdb``:: 48 | 49 | $ cd base/ 50 | $ gdb -x ../contrib/debug_bootstrap.gdb 51 | 52 | This will start ``gdb``, attempt to run the bootstrap process using the debug build of julia, and print out a backtrace if (when) it segfaults. You may need to hit ```` a few times to get the full backtrace. Create a gist_ with the backtrace, the `version info`_, and any other pertinent information you can think of and open a new issue_ on Github with a link to the gist. 53 | 54 | 55 | .. _Segfaults when running a script: 56 | 57 | Segfaults when running a script 58 | ------------------------------- 59 | 60 | The procedure is very similar to `Segfaults during bootstrap (sysimg.jl)`_. Create a debug build of Julia, and run your script inside of a debugged julia process:: 61 | 62 | $ cd 63 | $ make debug 64 | $ gdb --args usr/bin/julia-debug 65 | 66 | Note that ``gdb`` will sit there, waiting for instructions. Type ``r`` to run the process, and ``bt`` to generate a backtrace once it segfaults:: 67 | 68 | (gdb) r 69 | Starting program: /home/sabae/src/julia/usr/bin/julia-debug ./test.jl 70 | ... 71 | (gdb) bt 72 | 73 | Create a gist_ with the backtrace, the `version info`_, and any other pertinent information you can think of and open a new issue_ on Github with a link to the gist. 74 | 75 | 76 | .. _Errors during julia startup: 77 | 78 | Errors during julia startup 79 | --------------------------- 80 | 81 | Occasionally errors occur during julia's startup process (especially when using binary distributions, as opposed to compiling from source) such as the following:: 82 | 83 | $ julia 84 | exec: error -5 85 | 86 | These errors typically indicate something is not getting loaded properly very early on in the bootup phase, and our best bet in determining what's going wrong is to use external tools to audit the disk activity of the ``julia`` process: 87 | 88 | * On Linux, use ``strace``:: 89 | 90 | $ strace julia 91 | 92 | * On OSX, use ``dtruss``:: 93 | 94 | $ dtruss -f julia 95 | 96 | Create a gist_ with the ``strace``/ ``dtruss`` ouput, the `version info`_, and any other pertinent information and open a new issue_ on Github with a link to the gist. 97 | 98 | 99 | Glossary 100 | -------- 101 | 102 | A few terms have been used as shorthand in this guide: 103 | 104 | * ```` refers to the root directory of the julia source tree; e.g. it should contain folders such as ``base``, ``deps``, ``src``, ``test``, etc..... 105 | 106 | .. _gist: https://gist.github.com 107 | .. _issue: https://github.com/JuliaLang/julia/issues?state=open 108 | -------------------------------------------------------------------------------- /_original/devdocs/julia.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-index: 4 | 5 | #################################### 6 | Documentation of Julia's Internals 7 | #################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | init 13 | eval 14 | ast 15 | types 16 | object 17 | cartesian 18 | meta 19 | subarrays 20 | sysimg 21 | llvm 22 | stdio 23 | promote-op 24 | -------------------------------------------------------------------------------- /_original/devdocs/llvm.rst: -------------------------------------------------------------------------------- 1 | .. _devdocs-llvm: 2 | 3 | Working with LLVM 4 | ================= 5 | 6 | This is not a replacement for the LLVM documentation, but a collection 7 | of tips for working on LLVM for Julia. 8 | 9 | Overview of Julia to LLVM Interface 10 | ----------------------------------- 11 | 12 | Julia statically links in LLVM by default. 13 | Build with ``USE_LLVM_SHLIB=1`` to link dynamically. 14 | 15 | The code for lowering Julia AST to LLVM IR or interpreting it directly is in 16 | directory ``src/``. 17 | 18 | +---------------------+-------------------------------------------------------------+ 19 | |``builtins.c`` | Builtin functions | 20 | +---------------------+-------------------------------------------------------------+ 21 | |``ccall.cpp`` | Lowering ``ccall`` | 22 | +---------------------+-------------------------------------------------------------+ 23 | |``cgutils.cpp`` | Lowering utilities, notably for array and tuple accesses | 24 | +---------------------+-------------------------------------------------------------+ 25 | |``codegen.cpp`` | Top-level of code generation, pass list, lowering builtins | 26 | +---------------------+-------------------------------------------------------------+ 27 | |``debuginfo.cpp`` | Tracks debug information for JIT code | 28 | +---------------------+-------------------------------------------------------------+ 29 | |``disasm.cpp`` | Handles native object file and JIT code diassembly | 30 | +---------------------+-------------------------------------------------------------+ 31 | |``gf.c`` | Generic functions | 32 | +---------------------+-------------------------------------------------------------+ 33 | |``intrinsics.cpp`` | Lowering intrinsics | 34 | +---------------------+-------------------------------------------------------------+ 35 | |``llvm-simdloop.cpp``| Custom LLVM pass for ``@simd`` | 36 | +---------------------+-------------------------------------------------------------+ 37 | |``sys.c`` | I/O and operating system utility functions | 38 | +---------------------+-------------------------------------------------------------+ 39 | 40 | Some of the ``.cpp`` files form a group that compile to a single object. 41 | 42 | The difference between an intrinsic and a builtin is that a builtin is a first class 43 | function that can be used like any other Julia function. An intrinsic can operate 44 | only on unboxed data, and therefore its arguments must be statically typed. 45 | 46 | Alias Analysis 47 | ^^^^^^^^^^^^^^ 48 | 49 | Julia currently uses LLVM's `Type Based Alias Analysis `_. 50 | To find the comments that document the inclusion relationships, look for ``static MDNode*`` 51 | in ``src/codegen.cpp``. 52 | 53 | The ``-O`` option enables LLVM's `Basic Alias Analysis `_. 54 | 55 | Building Julia with a different version of LLVM 56 | ----------------------------------------------- 57 | 58 | The default version of LLVM is specified in ``deps/Versions.make``. 59 | You can override it by creating a file called ``Make.user`` in the top-level directory and adding a line to it such as: 60 | 61 | ```make 62 | LLVM_VER = 3.5.0 63 | ``` 64 | 65 | Besides the LLVM release numerals, you can 66 | also use ``LLVM_VER = svn`` to bulid against the latest development version 67 | of LLVM. 68 | 69 | Passing options to LLVM 70 | ----------------------- 71 | 72 | You can pass options to LLVM using *debug* builds of Julia. To create a debug 73 | build, run ``make debug``. The resulting executable is ``usr/bin/julia-debug``. 74 | You can pass LLVM options to this executable via the environment variable ``JULIA_LLVM_ARGS``. 75 | Here are example settings using ``bash`` syntax: 76 | 77 | * ``export JULIA_LLVM_ARGS = -print-after-all`` dumps IR after each pass. 78 | 79 | * ``export JULIA_LLVM_ARGS = -debug-only=loop-vectorize`` dumps LLVM ``DEBUG(...)`` 80 | diagnostics for loop vectorizer *if* you built Julia with ``LLVM_ASSERTIONS=1``. 81 | Otherwise you will get warnings about "Unknown command line argument". 82 | Counter-intuitively, building Julia with ``LLVM_DEBUG=1`` is *not* enough to 83 | dump ``DEBUG`` diagnostics from a pass. 84 | 85 | Improving LLVM optimizations for Julia 86 | -------------------------------------- 87 | 88 | Improving LLVM code generation usually involves either changing Julia lowering 89 | to be more friendly to LLVM's passes, or improving a pass. 90 | 91 | If you are planning to improve a pass, be sure to read the 92 | `LLVM developer policy `_. 93 | The best strategy is to create a code example in a form where you can use LLVM's 94 | ``opt`` tool to study it and the pass of interest in isolation. 95 | 96 | 1. Create an example Julia code of interest. 97 | 98 | 2. Use ``JULIA_LLVM_ARGS = -print-after-all`` to dump the IR. 99 | 100 | 3. Pick out the IR at the point just before the pass of interest runs. 101 | 102 | 4. Strip the debug metadata and fix up the TBAA metadata by hand. 103 | 104 | The last step is labor intensive. Suggestions on a better way would be appreciated. 105 | 106 | -------------------------------------------------------------------------------- /_original/devdocs/meta.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. _devdocs-meta: 4 | 5 | Talking to the compiler (the ``:meta`` mechanism) 6 | ================================================= 7 | 8 | In some circumstances, one might wish to provide hints or instructions 9 | that a given block of code has special properties: you might always 10 | want to inline it, or you might want to turn on special compiler 11 | optimization passes. Starting with version 0.4, julia has a 12 | convention that these instructions can be placed inside a ``:meta`` 13 | expression, which is typically (but not necessarily) the first 14 | expression in the body of a function. 15 | 16 | ``:meta`` expressions are created with macros. As an example, consider 17 | the implementation of the ``@inline`` macro:: 18 | 19 | macro inline(ex) 20 | esc(_inline(ex)) 21 | end 22 | 23 | _inline(ex::Expr) = pushmeta!(ex, :inline) 24 | _inline(arg) = arg 25 | 26 | Here, ``ex`` is expected to be an expression defining a function. 27 | A statement like this:: 28 | 29 | @inline function myfunction(x) 30 | x*(x+3) 31 | end 32 | 33 | gets turned into an expression like this:: 34 | 35 | quote 36 | function myfunction(x) 37 | Expr(:meta, :inline) 38 | x*(x+3) 39 | end 40 | end 41 | 42 | ``pushmeta!(ex, :symbol, args...)`` appends ``:symbol`` to the end of 43 | the ``:meta`` expression, creating a new ``:meta`` expression if 44 | necessary. If ``args`` is specified, a nested expression containing 45 | ``:symbol`` and these arguments is appended instead, which can be used 46 | to specify additional information. 47 | 48 | To use the metadata, you have to parse these ``:meta`` expressions. 49 | If your implementation can be performed within Julia, ``popmeta!`` is 50 | very handy: ``popmeta!(body, :symbol)`` will scan a function *body* 51 | expression (one without the function signature) for a ``:meta`` 52 | expression, extract any arguments, and return a tuple ``(found::Bool, 53 | args::Array{Any})``. If the metadata did not have any arguments, or 54 | ``:symbol`` was not found, the ``args`` array will be empty. 55 | 56 | Not yet provided is a convenient infrastructure for parsing ``:meta`` 57 | expressions from C++. 58 | -------------------------------------------------------------------------------- /_original/devdocs/promote-op.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. _devdocs-promote-op: 4 | 5 | Operator-sensitive promotion 6 | ============================ 7 | 8 | In certain cases, the :ref:`simple rules for promotion 9 | ` may not be sufficient. For example, consider a 10 | type that can represent an object with physical units, here restricted 11 | to a single unit like "meter":: 12 | 13 | immutable MeterUnits{T,P} <: Number 14 | val::T 15 | end 16 | MeterUnits{T}(val::T, pow::Int) = MeterUnits{T,pow}(val) 17 | 18 | m = MeterUnits(1.0, 1) # 1.0 meter, i.e. units of length 19 | m2 = MeterUnits(1.0, 2) # 1.0 meter^2, i.e. units of area 20 | 21 | Now let's define the operations ``+`` and ``*`` for these objects: 22 | ``m+m`` should have the type of ``m`` but ``m*m`` should have the type 23 | of ``m2``. When the result type depends on the operation, and not 24 | just the input types, ``promote_rule`` will be inadequate. 25 | 26 | Fortunately, it's possible to provide such definitions via ``promote_op``:: 27 | 28 | Base.promote_op{R,S}(::Base.AddFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),1} 29 | Base.promote_op{R,S}(::Base.MulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2} 30 | Base.promote_op{R,S}(::Base.DotMulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2} 31 | 32 | The first one defines the promotion rule for ``+``, and the second one 33 | for ``*``. ``AddFun``, ``MulFun``, and ``DotMulFun`` are "functor 34 | types" defined in `functor.jl 35 | `_. 36 | 37 | It's worth noting that as julia's internal representation of functions 38 | evolves, this interface may change in a future version of Julia. 39 | -------------------------------------------------------------------------------- /_original/devdocs/reflection.rst: -------------------------------------------------------------------------------- 1 | **************************** 2 | Reflection and introspection 3 | **************************** 4 | 5 | .. currentmodule:: Base 6 | 7 | Julia provides a variety of runtime reflection capabilities. 8 | 9 | .. rubric:: Module bindings 10 | 11 | The exported names for a :obj:`Module` are available using :func:`names(m::Module) `, which will return 12 | an array of :obj:`Symbol` elements representing the exported bindings. 13 | ``names(m::Module, true)`` returns symbols for all bindings in ``m``, regardless of export status. 14 | 15 | .. rubric:: DataType fields 16 | 17 | The names of :obj:`DataType` fields may be interrogated 18 | using :func:`fieldnames`. For example, given the following type, ``fieldnames(Point)`` returns an arrays of :obj:`Symbol` 19 | elements representing the field names: 20 | 21 | .. doctest:: 22 | 23 | julia> type Point 24 | x::Int 25 | y 26 | end 27 | 28 | julia> fieldnames(Point) 29 | 2-element Array{Symbol,1}: 30 | :x 31 | :y 32 | 33 | The type of each field in a ``Point`` object is stored in the ``types`` field of the ``Point`` variable itself: 34 | 35 | .. doctest:: 36 | 37 | julia> Point.types 38 | svec(Int64,Any) 39 | 40 | While ``x`` is annotated as an ``Int``, ``y`` was unannotated in the type definition, therefore ``y`` defaults to the ``Any`` type. 41 | 42 | Types are themselves represented as a structure called :obj:`DataType`: 43 | 44 | .. doctest:: 45 | 46 | julia> typeof(Point) 47 | DataType 48 | 49 | Note that ``fieldnames(DataType)`` gives the names for each field of :obj:`DataType` itself, and 50 | one of these fields is the ``types`` field observed in the example above. 51 | 52 | .. rubric:: Subtypes 53 | 54 | The *direct* subtypes of any :obj:`DataType` may be listed using 55 | :func:`subtypes`. For example, the abstract :obj:`DataType` :obj:`AbstractFloat` 56 | has four (concrete) subtypes: 57 | 58 | .. doctest:: 59 | 60 | julia> subtypes(AbstractFloat) 61 | 4-element Array{Any,1}: 62 | BigFloat 63 | Float16 64 | Float32 65 | Float64 66 | 67 | Any abstract subtype will also be included in this list, but further subtypes 68 | thereof will not; recursive application of :func:`subtypes` may be used to inspect 69 | the full type tree. 70 | 71 | .. rubric:: DataType layout 72 | 73 | The internal representation of a :obj:`DataType` is critically important when interfacing with 74 | C code and several functions are available to inspect these details. 75 | :func:`isbits(T::DataType) ` returns true if ``T`` is 76 | stored with C-compatible alignment. 77 | :func:`fieldoffsets(T::DataType) ` returns the (byte) offset for each 78 | field relative to the start of the type. 79 | 80 | .. rubric:: Function methods 81 | 82 | The methods of any generic function may be listed using :func:`methods`. The method dispatch 83 | table may be searched for methods accepting a given type using :func:`methodswith`. 84 | 85 | .. rubric:: Expansion and lowering 86 | 87 | As discussed in the :ref:`Metaprogramming ` section, the 88 | :func:`macroexpand` function gives the unquoted and interpolated expression (``Expr``) form 89 | for a given macro. To use ``macroexpand``, ``quote`` the expression block itself (otherwise, 90 | the macro will be evaluated and the result will be passed instead!). For example: 91 | 92 | .. doctest:: 93 | 94 | julia> macroexpand( :(@edit println("")) ) 95 | :(Base.edit(println,(Base.typesof)(""))) 96 | 97 | The functions :func:`Base.Meta.show_sexpr` and :func:`dump` are used to display S-expr style views 98 | and depth-nested detail views for any expression. 99 | 100 | Finally, the :func:`expand` function gives the ``lowered`` form of any expression and is of particular 101 | interest for understanding both macros and top-level statements such as function declarations and 102 | variable assignments: 103 | 104 | .. doctest:: 105 | 106 | julia> expand( :(f() = 1) ) 107 | :($(Expr(:method, :f, :((top(svec))((top(apply_type))(Tuple),(top(svec))())), AST(:($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin # none, line 1: 108 | return 1 109 | end))))), false))) 110 | 111 | .. rubric:: Intermediate and compiled representations 112 | 113 | Inspecting the lowered form for functions requires selection of the specific method to display, 114 | because generic functions may have many methods with different type signatures. For this purpose, 115 | method-specific code-lowering is available using :func:`code_lowered(f::Function, (Argtypes...)) `, 116 | and the type-inferred form is available using :func:`code_typed(f::Function, (Argtypes...)) `. 117 | :func:`code_warntype(f::Function, (Argtypes...)) ` adds 118 | highlighting to the output of :func:`code_typed` (see :ref:`man-code-warntype`). 119 | 120 | Closer to the machine, the LLVM intermediate representation of a function may be printed using by 121 | :func:`code_llvm(f::Function, (Argtypes...)) `, and finally the compiled machine code is 122 | available using :func:`code_native(f::Function, (Argtypes...) ` (this will trigger JIT 123 | compilation/code generation for any function which has not previously been called). 124 | 125 | For convenience, there are macro versions of the above functions which take standard function calls 126 | and expand argument types automatically:: 127 | 128 | julia> @code_llvm +(1,1) 129 | 130 | ; Function Attrs: sspreq 131 | define i64 @"julia_+_130862"(i64, i64) #0 { 132 | top: 133 | %2 = add i64 %1, %0, !dbg !8 134 | ret i64 %2, !dbg !8 135 | } 136 | 137 | .. not testable due to name variations 138 | 139 | (likewise ``@code_typed``, ``@code_warntype``, ``@code_lowered``, and ``@code_native``) 140 | -------------------------------------------------------------------------------- /_original/devdocs/stdio.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. highlight:: c 4 | 5 | *************************************** 6 | printf() and stdio in the Julia runtime 7 | *************************************** 8 | 9 | .. _dev-libuv: 10 | 11 | Libuv wrappers for stdio 12 | ------------------------ 13 | 14 | ``julia.h`` defines `libuv `_ wrappers for the 15 | ``stdio.h`` streams:: 16 | 17 | uv_stream_t *JL_STDIN; 18 | uv_stream_t *JL_STDOUT; 19 | uv_stream_t *JL_STDERR; 20 | 21 | ... and corresponding output functions:: 22 | 23 | int jl_printf(uv_stream_t *s, const char *format, ...); 24 | int jl_vprintf(uv_stream_t *s, const char *format, va_list args); 25 | 26 | These ``printf`` functions are used by :code:`julia/{src,ui}/*.c` wherever stdio 27 | is needed to ensure that output buffering is handled in a unified 28 | way. 29 | 30 | In special cases, like signal handlers, where the full ``libuv`` 31 | infrastructure is too heavy, :func:`jl_safe_printf` can be used to 32 | :func:`write(2) ` directly to :data:`STDERR_FILENO`:: 33 | 34 | void jl_safe_printf(const char *str, ...); 35 | 36 | 37 | 38 | Interface between JL_STD* and Julia code 39 | ---------------------------------------- 40 | 41 | :data:`Base.STDIN`, :data:`Base.STDOUT` and :data:`Base.STDERR` are 42 | bound to the :code:`JL_STD*` `libuv `_ streams 43 | defined in the runtime. 44 | 45 | Julia's :c:func:`__init__` function (in ``base/sysimg.jl``) calls 46 | :c:func:`reinit_stdio` (in ``base/stream.jl``) to create Julia objects 47 | for :data:`Base.STDIN`, :data:`Base.STDOUT` and :data:`Base.STDERR`. 48 | 49 | :c:func:`reinit_stdio` uses :func:`ccall` to retrieve pointers to 50 | :code:`JL_STD*` and calls :c:func:`jl_uv_handle_type` to inspect 51 | the type of each stream. It then creates a Julia :obj:`Base.File`, 52 | :obj:`Base.TTY` or :obj:`Base.Pipe` object to represent each 53 | stream, e.g.: 54 | 55 | .. code-block:: sh 56 | 57 | $ julia -e 'typeof((STDIN, STDOUT, STDERR))' 58 | (TTY,TTY,TTY) 59 | 60 | $ julia -e 'println(typeof((STDIN, STDOUT, STDERR)))' < /dev/null 2>/dev/null 61 | (Base.FS.File,TTY,Base.FS.File) 62 | 63 | $ echo hello | julia -e 'println(typeof((STDIN, STDOUT, STDERR)))' | cat 64 | (Pipe,Pipe,TTY) 65 | 66 | The :func:`Base.read` and :func:`Base.write` methods for these 67 | streams use :func:`ccall` to call ``libuv`` wrappers in :code:`src/jl_uv.c`, e.g.:: 68 | 69 | stream.jl: function write(s::AsyncStream, p::Ptr, nb::Integer) 70 | -> ccall(:jl_uv_write, ...) 71 | jl_uv.c: -> int jl_uv_write(uv_stream_t *stream, ...) 72 | -> uv_write(uvw, stream, buf, ...) 73 | 74 | printf() during initialisation 75 | ------------------------------ 76 | 77 | The ``libuv`` streams relied upon by :c:func:`jl_printf` etc., are not 78 | available until midway through initialisation of the runtime (see 79 | ``init.c``, :c:func:`init_stdio`). Error messages or warnings that need 80 | to be printed before this are routed to the standard C library 81 | :c:func:`fwrite` function by the following mechanism: 82 | 83 | In ``sys.c``, the :code:`JL_STD*` stream pointers are statically initialised 84 | to integer constants: ``STD*_FILENO (0, 1 and 2)``. In ``jl_uv.c`` the 85 | :c:func:`jl_write` function checks its :code:`uv_stream_t* stream` 86 | argument and calls :c:func:`fwrite` if stream is set to :c:macro:`STDOUT_FILENO` 87 | or :c:macro:`STDERR_FILENO`. 88 | 89 | This allows for uniform use of :c:func:`jl_printf` throughout the 90 | runtime regardless of whether or not any particular piece of code 91 | is reachable before initialisation is complete. 92 | 93 | 94 | .. _dev-ios: 95 | 96 | Legacy ios.c library 97 | -------------------- 98 | 99 | The :code:`julia/src/support/ios.c` library is inherited from `femtolisp `_. 100 | It provides cross-platform buffered file IO and in-memory temporary buffers. 101 | 102 | :code:`ios.c` is still used by: 103 | 104 | - :code:`julia/src/flisp/*.c` 105 | - :code:`julia/src/dump.c` -- for serialisation file IO and for memory buffers. 106 | - :code:`base/iostream.jl` -- for file IO (see :code:`base/fs.jl` for ``libuv`` equivalent). 107 | 108 | Use of :code:`ios.c` in these modules is mostly self-contained and 109 | separated from the ``libuv`` I/O system. However, there is `one place 110 | `_ 111 | where femtolisp calls through to :c:func:`jl_printf` with a legacy :c:type:`ios_t` stream. 112 | 113 | There is a hack in :code:`ios.h` that makes the :c:member:`ios_t.bm` 114 | field line up with the :code:`uv_stream_t.type` and ensures that 115 | the values used for :code:`ios_t.bm` to not overlap with valid 116 | UV_HANDLE_TYPE values. This allows :c:type:`uv_stream_t` pointers 117 | to point to :c:type:`ios_t` streams. 118 | 119 | This is needed because :c:func:`jl_printf` caller :c:func:`jl_static_show` 120 | is passed an :code:`ios_t` stream by femtolisp's :c:func:`fl_print` function. 121 | Julia's :c:func:`jl_write` function has special handling for this:: 122 | 123 | if (stream->type > UV_HANDLE_TYPE_MAX) { 124 | return ios_write((ios_t*)stream, str, n); 125 | } 126 | -------------------------------------------------------------------------------- /_original/devdocs/sysimg.rst: -------------------------------------------------------------------------------- 1 | ********************* 2 | System Image Building 3 | ********************* 4 | 5 | .. _dev-sysimg: 6 | 7 | Building the Julia system image 8 | ------------------------------- 9 | 10 | Julia ships with a preparsed system image containing the contents of the ``Base`` module, named ``sys.ji``. This file is also precompiled into a shared library called ``sys.{so,dll,dylib}`` on as many platforms as possible, so as to give vastly improved startup times. On systems that do not ship with a precompiled system image file, one can be generated from the source files shipped in Julia's ``DATAROOTDIR/julia/base`` folder. 11 | 12 | This operation is useful for multiple reasons. A user may: 13 | 14 | * Build a precompiled shared library system image on a platform that did not ship with one, thereby improving startup times. 15 | 16 | * Modify ``Base``, rebuild the system image and use the new ``Base`` next time Julia is started. 17 | 18 | * Include a ``userimg.jl`` file that includes packages into the system image, thereby creating a system image that has packages embedded into the startup environment. 19 | 20 | Julia now ships with a script that automates the tasks of building the system image, wittingly named ``build_sysimg.jl`` that lives in ``DATAROOTDIR/julia/``. That is, to include it into a current Julia session, type: 21 | :: 22 | 23 | include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "build_sysimg.jl")) 24 | 25 | This will include a ``build_sysimg()`` function: 26 | 27 | .. function:: build_sysimg(sysimg_path=default_sysimg_path, cpu_target="native", userimg_path=nothing; force=false) 28 | 29 | Rebuild the system image. Store it in ``sysimg_path``, which defaults to a file named ``sys.ji`` that sits in the same folder as ``libjulia.{so,dylib}``, except on Windows where it defaults to ``JULIA_HOME/../lib/julia/sys.ji``. 30 | Use the cpu instruction set given by ``cpu_target``. Valid CPU targets are the same as for the ``-C`` option to ``julia``, or the ``-march`` option to ``gcc``. Defaults to ``native``, which means to use all CPU instructions available on the current processor. 31 | Include the user image file given by ``userimg_path``, which should contain directives such as ``using MyPackage`` to include that package in the new system image. 32 | New system image will not replace an older image unless ``force`` is set to true. 33 | 34 | Note that this file can also be run as a script itself, with command line arguments taking the place of arguments passed to the ``build_sysimg`` function. For example, to build a system image in ``/tmp/sys.{so,dll,dylib}``, with the ``core2`` CPU instruction set, a user image of ``~/userimg.jl`` and ``force`` set to ``true``, one would execute: 35 | :: 36 | 37 | julia build_sysimg.jl /tmp/sys core2 ~/userimg.jl --force 38 | -------------------------------------------------------------------------------- /_original/devdocs/valgrind.rst: -------------------------------------------------------------------------------- 1 | ************************* 2 | Using Valgrind with Julia 3 | ************************* 4 | 5 | `Valgrind `_ is a tool for memory debugging, memory leak detection, and profiling. This section describes things to keep in mind when using Valgrind to debug memory issues with Julia. 6 | 7 | General considerations 8 | ---------------------- 9 | 10 | By default, Valgrind assumes that there is no self modifying code in the programs it runs. This assumption works fine in most instances but fails miserably for a just-in-time compiler like ``julia``. For this reason it is crucial to pass ``--smc-check=all-non-file`` to ``valgrind``, else code may crash or behave unexpectedly (often in subtle ways). 11 | 12 | In some cases, to better detect memory errors using Valgrind it can help to compile ``julia`` with memory pools disabled. The compile-time flag ``MEMDEBUG`` disables memory pools in Julia, and ``MEMDEBUG2`` disables memory pools in FemtoLisp. To build ``julia`` with both flags, add the following line to ``Make.user``:: 13 | 14 | CFLAGS = -DMEMDEBUG -DMEMDEBUG2 15 | 16 | Another thing to note: if your program uses multiple workers processes, it is likely that you want all such worker processes to run under Valgrind, not just the parent process. To do this, pass ``--trace-children=yes`` to ``valgrind``. 17 | 18 | Suppressions 19 | ------------ 20 | 21 | Valgrind will typically display spurious warnings as it runs. To reduce the number of such warnings, it helps to provide a `suppressions file `_ to Valgrind. A sample suppressions file is included in the Julia source distribution at ``contrib/valgrind-julia.supp``. 22 | 23 | The suppressions file can be used from the ``julia/`` source directory as follows:: 24 | 25 | $ valgrind --smc-check=all-non-file --suppressions=contrib/valgrind-julia.supp ./julia progname.jl 26 | 27 | Any memory errors that are displayed should either be reported as bugs or contributed as additional suppressions. Note that some versions of Valgrind are `shipped with insufficient default suppressions `_, so that may be one thing to consider before submitting any bugs. 28 | 29 | Running the Julia test suite under Valgrind 30 | ------------------------------------------- 31 | 32 | It is possible to run the entire Julia test suite under Valgrind, but it does take quite some time (typically several hours). To do so, run the following command from the ``julia/test/`` directory:: 33 | 34 | valgrind --smc-check=all-non-file --trace-children=yes --suppressions=$PWD/../contrib/valgrind-julia.supp ../julia runtests.jl all 35 | 36 | If you would like to see a report of "definite" memory leaks, pass the flags ``--leak-check=full --show-leak-kinds=definite`` to ``valgrind`` as well. 37 | 38 | Caveats 39 | ------- 40 | 41 | Valgrind currently `does not support multiple rounding modes `_, so code that adjusts the rounding mode will behave differently when run under Valgrind. 42 | 43 | In general, if after setting ``--smc-check=all-non-file`` you find that your program behaves differently when run under Valgrind, it may help to pass ``--tool=none`` to ``valgrind`` as you investigate further. This will enable the minimal Valgrind machinery but will also run much faster than when the full memory checker is enabled. 44 | -------------------------------------------------------------------------------- /_original/index.rst: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%% 3 | Julia Documentation 4 | %%%%%%%%%%%%%%%%%%%%% 5 | 6 | * :ref:`manual` 7 | * :ref:`stdlib` 8 | * :ref:`devdocs` 9 | 10 | .. _manual: 11 | 12 | ######## 13 | Manual 14 | ######## 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | 19 | manual/introduction 20 | manual/getting-started 21 | manual/variables 22 | manual/integers-and-floating-point-numbers 23 | manual/mathematical-operations 24 | manual/complex-and-rational-numbers 25 | manual/strings 26 | manual/functions 27 | manual/control-flow 28 | manual/variables-and-scoping 29 | manual/types 30 | manual/methods 31 | manual/constructors 32 | manual/conversion-and-promotion 33 | manual/interfaces 34 | manual/modules 35 | manual/documentation 36 | manual/metaprogramming 37 | manual/arrays 38 | manual/linear-algebra 39 | manual/networking-and-streams 40 | manual/parallel-computing 41 | manual/dates 42 | manual/running-external-programs 43 | manual/calling-c-and-fortran-code 44 | manual/interacting-with-julia 45 | manual/embedding 46 | manual/packages 47 | manual/profile 48 | manual/performance-tips 49 | manual/workflow-tips 50 | manual/style-guide 51 | manual/faq 52 | manual/noteworthy-differences 53 | manual/unicode-input 54 | 55 | .. _stdlib: 56 | 57 | ################## 58 | Standard Library 59 | ################## 60 | 61 | .. toctree:: 62 | :maxdepth: 1 63 | 64 | stdlib/base 65 | stdlib/collections 66 | stdlib/math 67 | stdlib/numbers 68 | stdlib/strings 69 | stdlib/arrays 70 | stdlib/parallel 71 | stdlib/linalg 72 | stdlib/constants 73 | stdlib/file 74 | stdlib/io-network 75 | stdlib/punctuation 76 | stdlib/sort 77 | stdlib/pkg 78 | stdlib/dates 79 | stdlib/test 80 | stdlib/c 81 | stdlib/profile 82 | 83 | .. _devdocs: 84 | 85 | ####################### 86 | Developer Documentation 87 | ####################### 88 | 89 | .. toctree:: 90 | :maxdepth: 2 91 | 92 | devdocs/reflection 93 | devdocs/julia 94 | devdocs/C 95 | -------------------------------------------------------------------------------- /_original/latex.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | %%%%%%%%%%%%%%%%%%%%% 4 | Julia Documentation 5 | %%%%%%%%%%%%%%%%%%%%% 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | manual/index 11 | stdlib/index 12 | 13 | -------------------------------------------------------------------------------- /_original/manual/index.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _manual-index: 3 | 4 | ################## 5 | The Julia Manual 6 | ################## 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | introduction 12 | getting-started 13 | variables 14 | integers-and-floating-point-numbers 15 | mathematical-operations 16 | complex-and-rational-numbers 17 | strings 18 | functions 19 | control-flow 20 | variables-and-scoping 21 | types 22 | methods 23 | constructors 24 | conversion-and-promotion 25 | modules 26 | metaprogramming 27 | arrays 28 | linear-algebra 29 | networking-and-streams 30 | parallel-computing 31 | dates 32 | interacting-with-julia 33 | running-external-programs 34 | calling-c-and-fortran-code 35 | embedding 36 | packages 37 | profile 38 | performance-tips 39 | style-guide 40 | faq 41 | noteworthy-differences 42 | unicode-input 43 | -------------------------------------------------------------------------------- /_original/manual/introduction.rst: -------------------------------------------------------------------------------- 1 | .. _man-introduction: 2 | 3 | ************** 4 | Introduction 5 | ************** 6 | 7 | Scientific computing has traditionally required the highest performance, 8 | yet domain experts have largely moved to slower dynamic languages for 9 | daily work. We believe there are many good reasons to prefer dynamic 10 | languages for these applications, and we do not expect their use to 11 | diminish. Fortunately, modern language design and compiler techniques 12 | make it possible to mostly eliminate the performance trade-off and 13 | provide a single environment productive enough for prototyping and 14 | efficient enough for deploying performance-intensive applications. The 15 | Julia programming language fills this role: it is a flexible dynamic 16 | language, appropriate for scientific and numerical computing, with 17 | performance comparable to traditional statically-typed languages. 18 | 19 | Because Julia's compiler is different from the interpreters used 20 | for languages like Python or R, you may find that Julia's performance 21 | is unintuitive at first. If you find that something is slow, we highly 22 | recommend reading through the :ref:`man-performance-tips` 23 | section before trying anything else. Once you understand how Julia 24 | works, it's easy to write code that's nearly as fast as C. 25 | 26 | Julia features optional typing, multiple dispatch, and good 27 | performance, achieved using type inference and `just-in-time (JIT) 28 | compilation `_, 29 | implemented using `LLVM 30 | `_. It is 31 | multi-paradigm, combining features of imperative, functional, and 32 | object-oriented programming. Julia provides ease and expressiveness 33 | for high-level numerical computing, in the same way as languages such 34 | as R, MATLAB, and Python, but also supports general programming. To 35 | achieve this, Julia builds upon the lineage of 36 | mathematical programming languages, but also borrows much from popular 37 | dynamic languages, including `Lisp 38 | `_, `Perl 39 | `_, `Python 40 | `_, `Lua 41 | `_, and `Ruby 42 | `_. 43 | 44 | The most significant departures of Julia from typical dynamic languages 45 | are: 46 | 47 | - The core language imposes very little; the standard library is 48 | written in Julia itself, including primitive operations like integer 49 | arithmetic 50 | - A rich language of types for constructing and describing objects, 51 | that can also optionally be used to make type declarations 52 | - The ability to define function behavior across many combinations of 53 | argument types via `multiple 54 | dispatch `_ 55 | - Automatic generation of efficient, specialized code for different 56 | argument types 57 | - Good performance, approaching that of statically-compiled languages 58 | like C 59 | 60 | Although one sometimes speaks of dynamic languages as being "typeless", 61 | they are definitely not: every object, whether primitive or 62 | user-defined, has a type. The lack of type declarations in most dynamic 63 | languages, however, means that one cannot instruct the compiler about 64 | the types of values, and often cannot explicitly talk about types at 65 | all. In static languages, on the other hand, while one can — and usually 66 | must — annotate types for the compiler, types exist only at compile time 67 | and cannot be manipulated or expressed at run time. In Julia, types are 68 | themselves run-time objects, and can also be used to convey information 69 | to the compiler. 70 | 71 | While the casual programmer need not explicitly use types or multiple 72 | dispatch, they are the core unifying features of Julia: functions are 73 | defined on different combinations of argument types, and applied by 74 | dispatching to the most specific matching definition. This model is a 75 | good fit for mathematical programming, where it is unnatural for the 76 | first argument to "own" an operation as in traditional object-oriented 77 | dispatch. Operators are just functions with special notation — to extend 78 | addition to new user-defined data types, you define new methods for the 79 | ``+`` function. Existing code then seamlessly applies to the new data 80 | types. 81 | 82 | Partly because of run-time type inference (augmented by optional type 83 | annotations), and partly because of a strong focus on performance from 84 | the inception of the project, Julia's computational efficiency exceeds 85 | that of other dynamic languages, and even rivals that of 86 | statically-compiled languages. For large scale numerical problems, speed 87 | always has been, continues to be, and probably always will be crucial: 88 | the amount of data being processed has easily kept pace with Moore's Law 89 | over the past decades. 90 | 91 | Julia aims to create an unprecedented combination of ease-of-use, power, 92 | and efficiency in a single language. In addition to the above, some 93 | advantages of Julia over comparable systems include: 94 | 95 | - Free and open source (`MIT 96 | licensed `_) 97 | - User-defined types are as fast and compact as built-ins 98 | - No need to vectorize code for performance; devectorized code is fast 99 | - Designed for parallelism and distributed computation 100 | - Lightweight "green" threading 101 | (`coroutines `_) 102 | - Unobtrusive yet powerful type system 103 | - Elegant and extensible conversions and promotions for numeric and 104 | other types 105 | - Efficient support for 106 | `Unicode `_, including but not 107 | limited to `UTF-8 `_ 108 | - Call C functions directly (no wrappers or special APIs needed) 109 | - Powerful shell-like capabilities for managing other processes 110 | - Lisp-like macros and other metaprogramming facilities 111 | 112 | -------------------------------------------------------------------------------- /_original/manual/unicode-input.rst: -------------------------------------------------------------------------------- 1 | .. _man-unicode-input: 2 | 3 | *************** 4 | Unicode Input 5 | *************** 6 | 7 | .. only:: html 8 | 9 | .. warning:: 10 | This table may appear to contain missing characters in the second column, 11 | or even show characters that are inconsistent with the characters as they 12 | are rendered in the Julia REPL. In these cases, users are strongly 13 | advised to check their choice of fonts in their browser and REPL 14 | environment, as there are known issues with glyphs in many fonts. 15 | 16 | .. include:: unicode-input-table.rst 17 | 18 | .. only:: latex 19 | 20 | Please see the online documentation. 21 | 22 | -------------------------------------------------------------------------------- /_original/manual/variables.rst: -------------------------------------------------------------------------------- 1 | 2 | *********** 3 | Variables 4 | *********** 5 | 6 | A variable, in Julia, is a name associated (or bound) to a value. It's useful when you want to store a value (that you obtained after some math, for example) for later use. For example: 7 | 8 | .. doctest:: 9 | 10 | # Assign the value 10 to the variable x 11 | julia> x = 10 12 | 10 13 | 14 | # Doing math with x's value 15 | julia> x + 1 16 | 11 17 | 18 | # Reassign x's value 19 | julia> x = 1 + 1 20 | 2 21 | 22 | # You can assign values of other types, like strings of text 23 | julia> x = "Hello World!" 24 | "Hello World!" 25 | 26 | Julia provides an extremely flexible system for naming variables. 27 | Variable names are case-sensitive, and have no semantic meaning (that is, 28 | the language will not treat variables differently based on their names). 29 | 30 | .. raw:: latex 31 | 32 | \begin{CJK*}{UTF8}{gbsn} 33 | 34 | .. doctest:: 35 | 36 | julia> x = 1.0 37 | 1.0 38 | 39 | julia> y = -3 40 | -3 41 | 42 | julia> Z = "My string" 43 | "My string" 44 | 45 | julia> customary_phrase = "Hello world!" 46 | "Hello world!" 47 | 48 | julia> UniversalDeclarationOfHumanRightsStart = "人人生而自由,在尊严和权力上一律平等。" 49 | "人人生而自由,在尊严和权力上一律平等。" 50 | 51 | .. raw:: latex 52 | 53 | \end{CJK*} 54 | 55 | Unicode names (in UTF-8 encoding) are allowed: 56 | 57 | .. raw:: latex 58 | 59 | \begin{CJK*}{UTF8}{mj} 60 | 61 | .. doctest:: 62 | 63 | julia> δ = 0.00001 64 | 1.0e-5 65 | 66 | julia> 안녕하세요 = "Hello" 67 | "Hello" 68 | 69 | In the Julia REPL and several other Julia editing environments, you 70 | can type many Unicode math symbols by typing the backslashed LaTeX symbol 71 | name followed by tab. For example, the variable name ``δ`` can be 72 | entered by typing ``\delta``-*tab*, or even ``α̂₂`` by 73 | ``\alpha``-*tab*-``\hat``-*tab*-``\_2``-*tab*. 74 | 75 | .. raw:: latex 76 | 77 | \end{CJK*} 78 | 79 | Julia will even let you redefine built-in constants and functions if needed: 80 | 81 | .. doctest:: 82 | 83 | julia> pi 84 | π = 3.1415926535897... 85 | 86 | julia> pi = 3 87 | WARNING: imported binding for pi overwritten in module Main 88 | 3 89 | 90 | julia> pi 91 | 3 92 | 93 | julia> sqrt(100) 94 | 10.0 95 | 96 | julia> sqrt = 4 97 | WARNING: imported binding for sqrt overwritten in module Main 98 | 4 99 | 100 | However, this is obviously not recommended to avoid potential confusion. 101 | 102 | Allowed Variable Names 103 | ====================== 104 | 105 | Variable names must begin with a letter (A-Z or a-z), underscore, or a 106 | subset of Unicode code points greater than 00A0; in particular, `Unicode character categories`_ Lu/Ll/Lt/Lm/Lo/Nl (letters), Sc/So (currency and 107 | other symbols), and a few other letter-like characters (e.g. a subset 108 | of the Sm math symbols) are allowed. Subsequent characters may also 109 | include ! and digits (0-9 and other characters in categories Nd/No), 110 | as well as other Unicode code points: diacritics and other modifying 111 | marks (categories Mn/Mc/Me/Sk), some punctuation connectors (category 112 | Pc), primes, and a few other characters. 113 | 114 | .. _Unicode character categories: http://www.fileformat.info/info/unicode/category/index.htm 115 | 116 | Operators like ``+`` are also valid identifiers, but are parsed specially. In 117 | some contexts, operators can be used just like variables; for example 118 | ``(+)`` refers to the addition function, and ``(+) = f`` will reassign 119 | it. Most of the Unicode infix operators (in category Sm), 120 | such as ``⊕``, are parsed as infix operators and are available for 121 | user-defined methods (e.g. you can use ``const ⊗ = kron`` to define 122 | ``⊗`` as an infix Kronecker product). 123 | 124 | The only explicitly disallowed names for variables are the names of built-in 125 | statements: 126 | 127 | .. doctest:: 128 | 129 | julia> else = false 130 | ERROR: syntax: unexpected "else" 131 | 132 | julia> try = "No" 133 | ERROR: syntax: unexpected "=" 134 | 135 | 136 | Stylistic Conventions 137 | ===================== 138 | 139 | While Julia imposes few restrictions on valid names, it has become useful to 140 | adopt the following conventions: 141 | 142 | - Names of variables are in lower case. 143 | - Word separation can be indicated by underscores (``'_'``), but use of 144 | underscores is discouraged unless the name would be hard to read otherwise. 145 | - Names of ``Type``\ s and ``Module``\ s begin with a capital letter and word separation is 146 | shown with upper camel case instead of underscores. 147 | - Names of ``function``\ s and ``macro``\s are in lower case, without 148 | underscores. 149 | - Functions that write to their arguments have names that end in ``!``. 150 | These are sometimes called "mutating" or "in-place" functions because 151 | they are intended to produce changes in their arguments after the 152 | function is called, not just return a value. 153 | -------------------------------------------------------------------------------- /_original/manual/workflow-tips.rst: -------------------------------------------------------------------------------- 1 | .. _man-workflow-tips: 2 | 3 | *************** 4 | Workflow Tips 5 | *************** 6 | 7 | Here are some tips for working with Julia efficiently. 8 | 9 | REPL-based workflow 10 | ------------------- 11 | 12 | As already elaborated in :ref:`man-interacting-with-julia`, Julia's 13 | REPL provides rich functionality that facilitates an efficient 14 | interactive workflow. Here are some tips that might further enhance your 15 | experience at the command line. 16 | 17 | A basic editor/REPL workflow 18 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | 20 | The most basic Julia workflows involve using a text editor in 21 | conjunction with the ``julia`` command line. A common pattern includes 22 | the following elements: 23 | 24 | - **Put code under development in a temporary module.** Create a file, 25 | say ``Tmp.jl``, and include within it :: 26 | 27 | module Tmp 28 | 29 | 30 | 31 | end 32 | 33 | - **Put your test code in another file.** Create another file, say 34 | ``tst.jl``, which begins with :: 35 | 36 | import Tmp 37 | 38 | and includes tests for the contents of ``Tmp``. The value of using 39 | :obj:`import` versus :obj:`using` is that you can call :obj:`reload` 40 | ``("Tmp")`` instead of having to restart the REPL when your 41 | definitions change. Of course, the cost is the need to prepend 42 | ``Tmp.`` to uses of names defined in your module. (You can lower that 43 | cost by keeping your module name short.) 44 | 45 | Alternatively, you can wrap the contents of your test file in a 46 | module, as :: 47 | 48 | module Tst 49 | using Tmp 50 | 51 | 52 | 53 | end 54 | 55 | The advantage is that you can now do :obj:`using` ``Tmp`` in your 56 | test code and can therefore avoid prepending ``Tmp.`` everywhere. 57 | The disadvantage is that code can no longer be selectively copied 58 | to the REPL without some tweaking. 59 | 60 | - **Lather. Rinse. Repeat.** Explore ideas at the ``julia`` command 61 | prompt. Save good ideas in ``tst.jl``. Occasionally 62 | restart the REPL, issuing :: 63 | 64 | reload("Tmp") 65 | include("tst.jl") 66 | 67 | Simplify initialization 68 | ~~~~~~~~~~~~~~~~~~~~~~~ 69 | 70 | To simplify restarting the REPL, put project-specific initialization 71 | code in a file, say ``_init.jl``, which you can run on startup by 72 | issuing the command:: 73 | 74 | julia -L _init.jl 75 | 76 | If you further add the following to your ``.juliarc.jl`` file :: 77 | 78 | isinteractive() && isfile("_init.jl") && require("_init.jl") 79 | 80 | then calling ``julia`` from that directory will run the initialization 81 | code without the additional command line argument. 82 | 83 | Browser-based workflow 84 | ---------------------- 85 | 86 | It is also possible to interact with a Julia REPL in the browser via IJulia_. See the package home for details. 87 | 88 | .. _IJulia: https://github.com/JuliaLang/IJulia.jl 89 | -------------------------------------------------------------------------------- /_original/stdlib/constants.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | Constants 4 | ========= 5 | 6 | .. data:: nothing 7 | 8 | The singleton instance of type ``Void``, used by convention when there is no value to 9 | return (as in a C ``void`` function). 10 | Can be converted to an empty ``Nullable`` value. 11 | 12 | .. data:: OS_NAME 13 | 14 | A symbol representing the name of the operating system. Possible values 15 | are ``:Linux``, ``:Darwin`` (OS X), or ``:Windows``. 16 | 17 | .. data:: ARGS 18 | 19 | An array of the command line arguments passed to Julia, as strings. 20 | 21 | .. data:: C_NULL 22 | 23 | The C null pointer constant, sometimes used when calling external code. 24 | 25 | .. data:: CPU_CORES 26 | 27 | The number of CPU cores in the system. 28 | 29 | .. data:: WORD_SIZE 30 | 31 | Standard word size on the current machine, in bits. 32 | 33 | .. data:: VERSION 34 | 35 | An object describing which version of Julia is in use. 36 | 37 | .. data:: LOAD_PATH 38 | 39 | An array of paths (as strings) where the ``require`` function looks for code. 40 | 41 | .. data:: JULIA_HOME 42 | 43 | A string containing the full path to the directory containing the ``julia`` executable. 44 | 45 | .. data:: ANY 46 | 47 | Equivalent to ``Any`` for dispatch purposes, but signals the compiler to skip code generation specialization for that field 48 | 49 | See also: 50 | 51 | :data:`STDIN` 52 | :data:`STDOUT` 53 | :data:`STDERR` 54 | :data:`ENV` 55 | :data:`ENDIAN_BOM` 56 | :data:`MS_ASYNC` 57 | :data:`MS_INVALIDATE` 58 | :data:`MS_SYNC` 59 | :data:`DL_LOAD_PATH` 60 | :data:`RTLD_DEEPBIND` 61 | :data:`RTLD_LOCAL` 62 | :data:`RTLD_NOLOAD` 63 | :data:`RTLD_LAZY` 64 | :data:`RTLD_NOW` 65 | :data:`RTLD_GLOBAL` 66 | :data:`RTLD_NODELETE` 67 | :data:`RTLD_FIRST` 68 | -------------------------------------------------------------------------------- /_original/stdlib/index.rst: -------------------------------------------------------------------------------- 1 | .. _stdlib-index: 2 | 3 | ############################ 4 | The Julia Standard Library 5 | ############################ 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | base 11 | collections 12 | math 13 | numbers 14 | strings 15 | arrays 16 | parallel 17 | linalg 18 | constants 19 | file 20 | io-network 21 | punctuation 22 | sort 23 | pkg 24 | test 25 | c 26 | libc 27 | libdl 28 | profile 29 | -------------------------------------------------------------------------------- /_original/stdlib/libc.rst: -------------------------------------------------------------------------------- 1 | .. module:: Libc 2 | 3 | ******************** 4 | C Standard Library 5 | ******************** 6 | 7 | .. function:: malloc(size::Integer) -> Ptr{Void} 8 | 9 | .. Docstring generated from Julia source 10 | 11 | Call ``malloc`` from the C standard library. 12 | 13 | .. function:: calloc(num::Integer, size::Integer) -> Ptr{Void} 14 | 15 | .. Docstring generated from Julia source 16 | 17 | Call ``calloc`` from the C standard library. 18 | 19 | .. function:: realloc(addr::Ptr, size::Integer) -> Ptr{Void} 20 | 21 | .. Docstring generated from Julia source 22 | 23 | Call ``realloc`` from the C standard library. 24 | 25 | See warning in the documentation for ``free`` regarding only using this on memory originally obtained from ``malloc``\ . 26 | 27 | .. function:: free(addr::Ptr) 28 | 29 | .. Docstring generated from Julia source 30 | 31 | Call ``free`` from the C standard library. Only use this on memory obtained from ``malloc``\ , not on pointers retrieved from other C libraries. ``Ptr`` objects obtained from C libraries should be freed by the free functions defined in that library, to avoid assertion failures if multiple ``libc`` libraries exist on the system. 32 | 33 | .. function:: errno([code]) 34 | 35 | .. Docstring generated from Julia source 36 | 37 | Get the value of the C library's ``errno``\ . If an argument is specified, it is used to set the value of ``errno``\ . 38 | 39 | The value of ``errno`` is only valid immediately after a ``ccall`` to a C library routine that sets it. Specifically, you cannot call ``errno`` at the next prompt in a REPL, because lots of code is executed between prompts. 40 | 41 | .. function:: strerror(n=errno()) 42 | 43 | .. Docstring generated from Julia source 44 | 45 | Convert a system call error code to a descriptive string 46 | 47 | .. function:: GetLastError() 48 | 49 | .. Docstring generated from Julia source 50 | 51 | Call the Win32 ``GetLastError`` function [only available on Windows]. 52 | 53 | .. function:: FormatMessage(n=GetLastError()) 54 | 55 | .. Docstring generated from Julia source 56 | 57 | Convert a Win32 system call error code to a descriptive string [only available on Windows]. 58 | 59 | .. function:: time(t::TmStruct) 60 | 61 | .. Docstring generated from Julia source 62 | 63 | Converts a ``TmStruct`` struct to a number of seconds since the epoch. 64 | 65 | .. function:: strftime([format], time) 66 | 67 | .. Docstring generated from Julia source 68 | 69 | Convert time, given as a number of seconds since the epoch or a ``TmStruct``\ , to a formatted string using the given format. Supported formats are the same as those in the standard C library. 70 | 71 | .. function:: strptime([format], timestr) 72 | 73 | .. Docstring generated from Julia source 74 | 75 | Parse a formatted time string into a ``TmStruct`` giving the seconds, minute, hour, date, etc. Supported formats are the same as those in the standard C library. On some platforms, timezones will not be parsed correctly. If the result of this function will be passed to ``time`` to convert it to seconds since the epoch, the ``isdst`` field should be filled in manually. Setting it to ``-1`` will tell the C library to use the current system settings to determine the timezone. 76 | 77 | .. function:: TmStruct([seconds]) 78 | 79 | .. Docstring generated from Julia source 80 | 81 | Convert a number of seconds since the epoch to broken-down format, with fields ``sec``\ , ``min``\ , ``hour``\ , ``mday``\ , ``month``\ , ``year``\ , ``wday``\ , ``yday``\ , and ``isdst``\ . 82 | 83 | .. function:: flush_cstdio() 84 | 85 | .. Docstring generated from Julia source 86 | 87 | Flushes the C ``stdout`` and ``stderr`` streams (which may have been written to by external C code). 88 | 89 | .. function:: msync(ptr, len, [flags]) 90 | 91 | .. Docstring generated from Julia source 92 | 93 | Forces synchronization of the :func:`mmap`\ ped memory region from ``ptr`` to ``ptr+len``. Flags defaults to ``MS_SYNC``, but can be a combination of ``MS_ASYNC``, ``MS_SYNC``, or ``MS_INVALIDATE``. See your platform man page for specifics. The flags argument is not valid on Windows. 94 | 95 | You may not need to call ``msync``, because synchronization is performed at intervals automatically by the operating system. However, you can call this directly if, for example, you are concerned about losing the result of a long-running calculation. 96 | 97 | .. data:: MS_ASYNC 98 | 99 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 100 | 101 | .. data:: MS_SYNC 102 | 103 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 104 | 105 | .. data:: MS_INVALIDATE 106 | 107 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 108 | -------------------------------------------------------------------------------- /_original/stdlib/libdl.rst: -------------------------------------------------------------------------------- 1 | .. module:: Libdl 2 | 3 | **************** 4 | Dynamic Linker 5 | **************** 6 | 7 | .. function:: dlopen(libfile::AbstractString [, flags::Integer]) 8 | 9 | .. Docstring generated from Julia source 10 | 11 | Load a shared library, returning an opaque handle. 12 | 13 | The optional flags argument is a bitwise-or of zero or more of ``RTLD_LOCAL``\ , ``RTLD_GLOBAL``\ , ``RTLD_LAZY``\ , ``RTLD_NOW``\ , ``RTLD_NODELETE``\ , ``RTLD_NOLOAD``\ , ``RTLD_DEEPBIND``\ , and ``RTLD_FIRST``\ . These are converted to the corresponding flags of the POSIX (and/or GNU libc and/or MacOS) dlopen command, if possible, or are ignored if the specified functionality is not available on the current platform. The default flags are platform specific. On MacOS the default ``dlopen`` flags are ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL`` while on other platforms the defaults are ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_LOCAL``\ . An important usage of these flags is to specify non default behavior for when the dynamic library loader binds library references to exported symbols and if the bound references are put into process local or global scope. For instance ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL`` allows the library's symbols to be available for usage in other shared libraries, addressing situations where there are dependencies between shared libraries. 14 | 15 | .. function:: dlopen_e(libfile::AbstractString [, flags::Integer]) 16 | 17 | .. Docstring generated from Julia source 18 | 19 | Similar to :func:`dlopen`, except returns a ``NULL`` pointer instead of raising errors. 20 | 21 | .. data:: RTLD_DEEPBIND 22 | 23 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 24 | 25 | .. data:: RTLD_FIRST 26 | 27 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 28 | 29 | .. data:: RTLD_GLOBAL 30 | 31 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 32 | 33 | .. data:: RTLD_LAZY 34 | 35 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 36 | 37 | .. data:: RTLD_LOCAL 38 | 39 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 40 | 41 | .. data:: RTLD_NODELETE 42 | 43 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 44 | 45 | .. data:: RTLD_NOLOAD 46 | 47 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 48 | 49 | .. data:: RTLD_NOW 50 | 51 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 52 | 53 | .. function:: dlsym(handle, sym) 54 | 55 | .. Docstring generated from Julia source 56 | 57 | Look up a symbol from a shared library handle, return callable function pointer on success. 58 | 59 | .. function:: dlsym_e(handle, sym) 60 | 61 | .. Docstring generated from Julia source 62 | 63 | Look up a symbol from a shared library handle, silently return ``NULL`` pointer on lookup failure. 64 | 65 | .. function:: dlclose(handle) 66 | 67 | .. Docstring generated from Julia source 68 | 69 | Close shared library referenced by handle. 70 | 71 | .. data:: dlext 72 | 73 | File extension for dynamic libraries (e.g. dll, dylib, so) on the current platform. 74 | 75 | .. function:: find_library(names, locations) 76 | 77 | .. Docstring generated from Julia source 78 | 79 | Searches for the first library in ``names`` in the paths in the ``locations`` list, ``DL_LOAD_PATH``\ , or system library paths (in that order) which can successfully be dlopen'd. On success, the return value will be one of the names (potentially prefixed by one of the paths in locations). This string can be assigned to a ``global const`` and used as the library name in future ``ccall``\ 's. On failure, it returns the empty string. 80 | 81 | .. data:: DL_LOAD_PATH 82 | 83 | When calling ``dlopen``, the paths in this list will be searched first, in order, before searching the 84 | system locations for a valid library handle. 85 | -------------------------------------------------------------------------------- /_original/stdlib/profile.rst: -------------------------------------------------------------------------------- 1 | .. module:: Profile 2 | 3 | .. _stdlib-profiling: 4 | 5 | *********** 6 | Profiling 7 | *********** 8 | 9 | .. currentmodule:: Base 10 | 11 | .. function:: @profile 12 | 13 | .. Docstring generated from Julia source 14 | 15 | ``@profile `` runs your expression while taking periodic backtraces. These are appended to an internal buffer of backtraces. 16 | 17 | .. currentmodule:: Base.Profile 18 | 19 | The methods in :mod:`Base.Profile` are not exported and need to be called e.g. as ``Profile.print()``. 20 | 21 | .. function:: clear() 22 | 23 | .. Docstring generated from Julia source 24 | 25 | Clear any existing backtraces from the internal buffer. 26 | 27 | .. function:: print([io::IO = STDOUT,] [data::Vector]; format = :tree, C = false, combine = true, cols = tty_cols()) 28 | 29 | .. Docstring generated from Julia source 30 | 31 | Prints profiling results to ``io`` (by default, ``STDOUT``). If you 32 | do not supply a ``data`` vector, the internal buffer of accumulated 33 | backtraces will be used. ``format`` can be ``:tree`` or 34 | ``:flat``. If ``C==true``, backtraces from C and Fortran code are 35 | shown. ``combine==true`` merges instruction pointers that 36 | correspond to the same line of code. ``cols`` controls the width 37 | of the display. 38 | 39 | .. function:: print([io::IO = STDOUT,] data::Vector, lidict::Dict; format = :tree, combine = true, cols = tty_cols()) 40 | 41 | .. Docstring generated from Julia source 42 | 43 | Prints profiling results to ``io``. This variant is used to examine 44 | results exported by a previous call to :func:`retrieve`. 45 | Supply the vector ``data`` of backtraces and a dictionary 46 | ``lidict`` of line information. 47 | 48 | .. function:: init(; n::Integer, delay::Float64) 49 | 50 | .. Docstring generated from Julia source 51 | 52 | Configure the ``delay`` between backtraces (measured in seconds), and the number ``n`` of instruction pointers that may be stored. Each instruction pointer corresponds to a single line of code; backtraces generally consist of a long list of instruction pointers. Default settings can be obtained by calling this function with no arguments, and each can be set independently using keywords or in the order ``(n, delay)``\ . 53 | 54 | .. function:: fetch() -> data 55 | 56 | .. Docstring generated from Julia source 57 | 58 | Returns a reference to the internal buffer of backtraces. Note that 59 | subsequent operations, like :func:`clear`, can affect 60 | ``data`` unless you first make a copy. Note that the values in 61 | ``data`` have meaning only on this machine in the current session, 62 | because it depends on the exact memory addresses used in 63 | JIT-compiling. This function is primarily for internal use; 64 | :func:`retrieve` may be a better choice for most users. 65 | 66 | .. function:: retrieve() -> data, lidict 67 | 68 | .. Docstring generated from Julia source 69 | 70 | "Exports" profiling results in a portable format, returning the set of all backtraces (``data``\ ) and a dictionary that maps the (session-specific) instruction pointers in ``data`` to ``LineInfo`` values that store the file name, function name, and line number. This function allows you to save profiling results for future analysis. 71 | 72 | .. function:: callers(funcname, [data, lidict], [filename=], [linerange=]) -> Vector{Tuple{count, linfo}} 73 | 74 | .. Docstring generated from Julia source 75 | 76 | Given a previous profiling run, determine who called a particular 77 | function. Supplying the filename (and optionally, range of line 78 | numbers over which the function is defined) allows you to 79 | disambiguate an overloaded method. The returned value is a vector 80 | containing a count of the number of calls and line information 81 | about the caller. One can optionally supply backtrace data 82 | obtained from :func:`retrieve`; otherwise, the current internal profile 83 | buffer is used. 84 | 85 | .. function:: clear_malloc_data() 86 | 87 | .. Docstring generated from Julia source 88 | 89 | Clears any stored memory allocation data when running julia with 90 | ``--track-allocation``. Execute the command(s) you want to test 91 | (to force JIT-compilation), then call :func:`clear_malloc_data`. 92 | Then execute your command(s) again, quit Julia, and examine the 93 | resulting ``*.mem`` files. 94 | 95 | -------------------------------------------------------------------------------- /_original/stdlib/punctuation.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Punctuation 3 | ************* 4 | 5 | Extended documentation for mathematical symbols & functions is :ref:`here `. 6 | 7 | ========= ================================================ 8 | symbol meaning 9 | ========= ================================================ 10 | ``@m`` invoke macro ``m``; followed by space-separated expressions 11 | ``!`` prefix "not" operator 12 | ``a!( )`` at the end of a function name, ``!`` indicates that a function modifies its argument(s) 13 | ``#`` begin single line comment 14 | ``#=`` begin multi-line comment (these are nestable) 15 | ``=#`` end multi-line comment 16 | ``$`` bitwise xor operator, string and expression interpolation 17 | ``%`` remainder operator 18 | ``^`` exponent operator 19 | ``&`` bitwise and 20 | ``&&`` short-circuiting boolean and 21 | ``|`` bitwise or 22 | ``||`` short-circuiting boolean or 23 | ``*`` multiply, or matrix multiply 24 | ``()`` the empty tuple 25 | ``~`` bitwise not operator 26 | ``\`` backslash operator 27 | ``'`` complex transpose operator A\ :sup:`H` 28 | ``a[]`` array indexing 29 | ``[,]`` vertical concatenation 30 | ``[;]`` also vertical concatenation 31 | ``[ ]`` with space-separated expressions, horizontal concatenation 32 | ``T{ }`` parametric type instantiation 33 | ``{ }`` construct a cell array (deprecated in 0.4 in favor of ``Any[]``) 34 | ``;`` statement separator 35 | ``,`` separate function arguments or tuple components 36 | ``?`` 3-argument conditional operator (conditional ? if_true : if_false) 37 | ``""`` delimit string literals 38 | ``''`` delimit character literals 39 | ``` ``` delimit external process (command) specifications 40 | ``...`` splice arguments into a function call or declare a varargs function or type 41 | ``.`` access named fields in objects or names inside modules, also prefixes elementwise operators 42 | ``a:b`` range a, a+1, a+2, ..., b 43 | ``a:s:b`` range a, a+s, a+2s, ..., b 44 | ``:`` index an entire dimension (1:end) 45 | ``::`` type annotation, depending on context 46 | ``:( )`` quoted expression 47 | ``:a`` symbol a 48 | ========= ================================================ 49 | -------------------------------------------------------------------------------- /_original/stdlib/test.rst: -------------------------------------------------------------------------------- 1 | ***************************** 2 | Unit and Functional Testing 3 | ***************************** 4 | 5 | Testing Base Julia 6 | ------------------ 7 | 8 | Julia is under rapid development and has an extensive test suite to 9 | verify functionality across multiple platforms. If you build Julia 10 | from source, you can run this test suite with ``make test``. In a 11 | binary install, you can run the test suite using ``Base.runtests()``. 12 | 13 | .. currentmodule:: Base 14 | 15 | .. function:: runtests([tests=["all"] [, numcores=iceil(CPU_CORES/2) ]]) 16 | 17 | .. Docstring generated from Julia source 18 | 19 | Run the Julia unit tests listed in ``tests``\ , which can be either a string or an array of strings, using ``numcores`` processors. (not exported) 20 | 21 | .. module:: Base.Test 22 | 23 | Test Framework 24 | -------------- 25 | 26 | The ``Test`` module contains macros and functions related to testing. 27 | A default handler is provided to run the tests, and a custom one can be 28 | provided by the user by using the :func:`registerhandler` function. 29 | 30 | To use the default handler, the macro :func:`@test` can be used directly:: 31 | 32 | julia> using Base.Test 33 | 34 | julia> @test 1 == 1 35 | 36 | julia> @test 1 == 0 37 | ERROR: test failed: 1 == 0 38 | in error at error.jl:21 39 | in default_handler at test.jl:19 40 | in do_test at test.jl:39 41 | 42 | julia> @test error("This is what happens when a test fails") 43 | ERROR: test error during error("This is what happens when a test fails") 44 | This is what happens when a test fails 45 | in error at error.jl:21 46 | in anonymous at test.jl:62 47 | in do_test at test.jl:37 48 | 49 | As seen in the examples above, failures or errors will print the abstract 50 | syntax tree of the expression in question. 51 | 52 | Another macro is provided to check if the given expression throws an exception of type ``extype``, 53 | :func:`@test_throws`:: 54 | 55 | julia> @test_throws ErrorException error("An error") 56 | ErrorException("An error") 57 | 58 | julia> @test_throws BoundsError error("An error") 59 | ERROR: test failed: error("An error") 60 | in error at error.jl:21 61 | in default_handler at test.jl:19 62 | in do_test_throws at test.jl:55 63 | 64 | julia> @test_throws DomainError throw(DomainError()) 65 | DomainError() 66 | 67 | julia> @test_throws DomainError throw(EOFError()) 68 | ERROR: test failed: throw(EOFError()) 69 | in error at error.jl:21 70 | in default_handler at test.jl:19 71 | in do_test_throws at test.jl:55 72 | 73 | 74 | As floating-point values can be imprecise, you can perform approximate 75 | equality checks using either ``@test a ≈ b`` (where ``≈``, typed via 76 | tab completion of ``\approx``, is the ``isapprox`` function) or use 77 | the macros ``@test_approx_eq`` macro (which differs from ``isapprox`` 78 | in that it treats NaN values as equal and has a smaller default 79 | tolerance) or ``@test_approx_eq_eps`` (which takes an extra argument 80 | indicating the relative tolerance):: 81 | 82 | julia> @test 1 ≈ 0.999999999 83 | 84 | julia> @test 1 ≈ 0.999999 85 | ERROR: test failed: 1 isapprox 0.999999 86 | in expression: 1 ≈ 0.999999 87 | in error at error.jl:21 88 | in default_handler at test.jl:30 89 | in do_test at test.jl:53 90 | 91 | julia> @test_approx_eq 1. 0.999999999 92 | ERROR: assertion failed: |1.0 - 0.999999999| < 2.220446049250313e-12 93 | 1.0 = 1.0 94 | 0.999999999 = 0.999999999 95 | in test_approx_eq at test.jl:75 96 | in test_approx_eq at test.jl:80 97 | 98 | julia> @test_approx_eq 1. 0.9999999999999 99 | 100 | julia> @test_approx_eq_eps 1. 0.999 1e-2 101 | 102 | julia> @test_approx_eq_eps 1. 0.999 1e-3 103 | ERROR: assertion failed: |1.0 - 0.999| <= 0.001 104 | 1.0 = 1.0 105 | 0.999 = 0.999 106 | difference = 0.0010000000000000009 > 0.001 107 | in error at error.jl:22 108 | in test_approx_eq at test.jl:68 109 | 110 | Handlers 111 | -------- 112 | 113 | A handler is a function defined for three kinds of arguments: ``Success``, ``Failure``, ``Error``:: 114 | 115 | # An example definition of a test handler 116 | test_handler(r::Success) = nothing 117 | test_handler(r::Failure) = error("test failed: $(r.expr)") 118 | test_handler(r::Error) = rethrow(r) 119 | 120 | A different handler can be used for a block (with :func:`with_handler`):: 121 | 122 | julia> using Base.Test 123 | 124 | julia> custom_handler(r::Test.Success) = println("Success on $(r.expr)") 125 | custom_handler (generic function with 1 method) 126 | 127 | julia> custom_handler(r::Test.Failure) = error("Error on custom handler: $(r.expr)") 128 | custom_handler (generic function with 2 methods) 129 | 130 | julia> custom_handler(r::Test.Error) = rethrow(r) 131 | custom_handler (generic function with 3 methods) 132 | 133 | julia> Test.with_handler(custom_handler) do 134 | @test 1 == 1 135 | @test 1 != 1 136 | end 137 | Success on :((1==1)) 138 | ERROR: Error on custom handler: :((1!=1)) 139 | in error at error.jl:21 140 | in custom_handler at none:1 141 | in do_test at test.jl:39 142 | in anonymous at no file:3 143 | in task_local_storage at task.jl:28 144 | in with_handler at test.jl:24 145 | 146 | The ``Success`` and ``Failure`` types include an additonal field, ``resultexpr``, which is a partially evaluated expression. For example, in a comparison it will contain an expression with the left and right sides evaluated. 147 | 148 | Macros 149 | ------ 150 | 151 | .. function:: @test(ex) 152 | 153 | .. Docstring generated from Julia source 154 | 155 | Test the expression ``ex`` and calls the current handler to handle the result. 156 | 157 | .. function:: @test_throws(extype, ex) 158 | 159 | .. Docstring generated from Julia source 160 | 161 | Test that the expression ``ex`` throws an exception of type ``extype`` and calls the current handler to handle the result. 162 | 163 | .. function:: @test_approx_eq(a, b) 164 | 165 | .. Docstring generated from Julia source 166 | 167 | Test two floating point numbers ``a`` and ``b`` for equality taking in account small numerical errors. 168 | 169 | .. function:: @test_approx_eq_eps(a, b, tol) 170 | 171 | .. Docstring generated from Julia source 172 | 173 | Test two floating point numbers ``a`` and ``b`` for equality taking in account a margin of tolerance given by ``tol``\ . 174 | 175 | Functions 176 | --------- 177 | 178 | .. function:: with_handler(f, handler) 179 | 180 | .. Docstring generated from Julia source 181 | 182 | Run the function ``f`` using the ``handler`` as the handler. 183 | 184 | -------------------------------------------------------------------------------- /devdocs/C.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-c-index: 4 | 5 | ##################################### 6 | Developing/debugging Julia's C code 7 | ##################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | backtraces 13 | debuggingtips 14 | valgrind 15 | -------------------------------------------------------------------------------- /devdocs/backtraces.rst: -------------------------------------------------------------------------------- 1 | ******************************************* 2 | Reporting and analyzing crashes (segfaults) 3 | ******************************************* 4 | 5 | So you managed to break Julia. Congratulations! Collected here are some general procedures you can undergo for common symptoms encountered when something goes awry. Including the information from these debugging steps can greatly help the maintainers when tracking down a segfault or trying to figure out why your script is running slower than expected. 6 | 7 | If you've been directed to this page, find the symptom that best matches what you're experiencing and follow the instructions to generate the debugging information requested. Table of symptoms: 8 | 9 | * `Segfaults during bootstrap (sysimg.jl)`_ 10 | 11 | * `Segfaults when running a script`_ 12 | 13 | * `Errors during julia startup`_ 14 | 15 | .. _version info: 16 | 17 | Version/Environment info 18 | ------------------------ 19 | 20 | No matter the error, we will always need to know what version of julia you are running. When julia first starts up, a header is printed out with a version number and date. If your version is ``0.2.0`` or higher, please include the output of ``versioninfo()`` in any report you create:: 21 | 22 | julia> versioninfo() 23 | Julia Version 0.3.3-pre+25 24 | Commit 417b50a* (2014-11-03 11:32 UTC) 25 | Platform Info: 26 | System: Linux (x86_64-linux-gnu) 27 | CPU: Intel(R) Core(TM) i7 CPU L 640 @ 2.13GHz 28 | WORD_SIZE: 64 29 | BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Nehalem) 30 | LAPACK: libopenblas 31 | LIBM: libopenlibm 32 | LLVM: libLLVM-3.3 33 | 34 | 35 | .. _Segfaults during bootstrap (sysimg.jl): 36 | 37 | Segfaults during bootstrap (sysimg.jl) 38 | -------------------------------------- 39 | 40 | Segfaults toward the end of the ``make`` process of building julia are a common symptom of something going wrong while julia is preparsing the corpus of code in the ``base/`` folder. Many factors can contribute toward this process dying unexpectedly, however it is as often as not due to an error in the C-code portion of julia, and as such must typically be debugged with a debug build inside of ``gdb``. Explicitly: 41 | 42 | Create a debug build of julia:: 43 | 44 | $ cd 45 | $ make debug 46 | 47 | Note that this process will likely fail with the same error as a normal ``make`` incantation, however this will create a debug executable that will offer ``gdb`` the debugging symbols needed to get accurate backtraces. Next, manually run the bootstrap process inside of ``gdb``:: 48 | 49 | $ cd base/ 50 | $ gdb -x ../contrib/debug_bootstrap.gdb 51 | 52 | This will start ``gdb``, attempt to run the bootstrap process using the debug build of julia, and print out a backtrace if (when) it segfaults. You may need to hit ```` a few times to get the full backtrace. Create a gist_ with the backtrace, the `version info`_, and any other pertinent information you can think of and open a new issue_ on Github with a link to the gist. 53 | 54 | 55 | .. _Segfaults when running a script: 56 | 57 | Segfaults when running a script 58 | ------------------------------- 59 | 60 | The procedure is very similar to `Segfaults during bootstrap (sysimg.jl)`_. Create a debug build of Julia, and run your script inside of a debugged julia process:: 61 | 62 | $ cd 63 | $ make debug 64 | $ gdb --args usr/bin/julia-debug 65 | 66 | Note that ``gdb`` will sit there, waiting for instructions. Type ``r`` to run the process, and ``bt`` to generate a backtrace once it segfaults:: 67 | 68 | (gdb) r 69 | Starting program: /home/sabae/src/julia/usr/bin/julia-debug ./test.jl 70 | ... 71 | (gdb) bt 72 | 73 | Create a gist_ with the backtrace, the `version info`_, and any other pertinent information you can think of and open a new issue_ on Github with a link to the gist. 74 | 75 | 76 | .. _Errors during julia startup: 77 | 78 | Errors during julia startup 79 | --------------------------- 80 | 81 | Occasionally errors occur during julia's startup process (especially when using binary distributions, as opposed to compiling from source) such as the following:: 82 | 83 | $ julia 84 | exec: error -5 85 | 86 | These errors typically indicate something is not getting loaded properly very early on in the bootup phase, and our best bet in determining what's going wrong is to use external tools to audit the disk activity of the ``julia`` process: 87 | 88 | * On Linux, use ``strace``:: 89 | 90 | $ strace julia 91 | 92 | * On OSX, use ``dtruss``:: 93 | 94 | $ dtruss -f julia 95 | 96 | Create a gist_ with the ``strace``/ ``dtruss`` ouput, the `version info`_, and any other pertinent information and open a new issue_ on Github with a link to the gist. 97 | 98 | 99 | Glossary 100 | -------- 101 | 102 | A few terms have been used as shorthand in this guide: 103 | 104 | * ```` refers to the root directory of the julia source tree; e.g. it should contain folders such as ``base``, ``deps``, ``src``, ``test``, etc..... 105 | 106 | .. _gist: https://gist.github.com 107 | .. _issue: https://github.com/JuliaLang/julia/issues?state=open 108 | -------------------------------------------------------------------------------- /devdocs/julia.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | .. _devdocs-index: 4 | 5 | #################################### 6 | Documentation of Julia's Internals 7 | #################################### 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | init 13 | eval 14 | ast 15 | types 16 | object 17 | cartesian 18 | meta 19 | subarrays 20 | sysimg 21 | llvm 22 | stdio 23 | promote-op 24 | -------------------------------------------------------------------------------- /devdocs/llvm.rst: -------------------------------------------------------------------------------- 1 | .. _devdocs-llvm: 2 | 3 | Working with LLVM 4 | ================= 5 | 6 | This is not a replacement for the LLVM documentation, but a collection 7 | of tips for working on LLVM for Julia. 8 | 9 | Overview of Julia to LLVM Interface 10 | ----------------------------------- 11 | 12 | Julia statically links in LLVM by default. 13 | Build with ``USE_LLVM_SHLIB=1`` to link dynamically. 14 | 15 | The code for lowering Julia AST to LLVM IR or interpreting it directly is in 16 | directory ``src/``. 17 | 18 | +---------------------+-------------------------------------------------------------+ 19 | |``builtins.c`` | Builtin functions | 20 | +---------------------+-------------------------------------------------------------+ 21 | |``ccall.cpp`` | Lowering ``ccall`` | 22 | +---------------------+-------------------------------------------------------------+ 23 | |``cgutils.cpp`` | Lowering utilities, notably for array and tuple accesses | 24 | +---------------------+-------------------------------------------------------------+ 25 | |``codegen.cpp`` | Top-level of code generation, pass list, lowering builtins | 26 | +---------------------+-------------------------------------------------------------+ 27 | |``debuginfo.cpp`` | Tracks debug information for JIT code | 28 | +---------------------+-------------------------------------------------------------+ 29 | |``disasm.cpp`` | Handles native object file and JIT code diassembly | 30 | +---------------------+-------------------------------------------------------------+ 31 | |``gf.c`` | Generic functions | 32 | +---------------------+-------------------------------------------------------------+ 33 | |``intrinsics.cpp`` | Lowering intrinsics | 34 | +---------------------+-------------------------------------------------------------+ 35 | |``llvm-simdloop.cpp``| Custom LLVM pass for ``@simd`` | 36 | +---------------------+-------------------------------------------------------------+ 37 | |``sys.c`` | I/O and operating system utility functions | 38 | +---------------------+-------------------------------------------------------------+ 39 | 40 | Some of the ``.cpp`` files form a group that compile to a single object. 41 | 42 | The difference between an intrinsic and a builtin is that a builtin is a first class 43 | function that can be used like any other Julia function. An intrinsic can operate 44 | only on unboxed data, and therefore its arguments must be statically typed. 45 | 46 | Alias Analysis 47 | ^^^^^^^^^^^^^^ 48 | 49 | Julia currently uses LLVM's `Type Based Alias Analysis `_. 50 | To find the comments that document the inclusion relationships, look for ``static MDNode*`` 51 | in ``src/codegen.cpp``. 52 | 53 | The ``-O`` option enables LLVM's `Basic Alias Analysis `_. 54 | 55 | Building Julia with a different version of LLVM 56 | ----------------------------------------------- 57 | 58 | The default version of LLVM is specified in ``deps/Versions.make``. 59 | You can override it by creating a file called ``Make.user`` in the top-level directory and adding a line to it such as: 60 | 61 | ```make 62 | LLVM_VER = 3.5.0 63 | ``` 64 | 65 | Besides the LLVM release numerals, you can 66 | also use ``LLVM_VER = svn`` to bulid against the latest development version 67 | of LLVM. 68 | 69 | Passing options to LLVM 70 | ----------------------- 71 | 72 | You can pass options to LLVM using *debug* builds of Julia. To create a debug 73 | build, run ``make debug``. The resulting executable is ``usr/bin/julia-debug``. 74 | You can pass LLVM options to this executable via the environment variable ``JULIA_LLVM_ARGS``. 75 | Here are example settings using ``bash`` syntax: 76 | 77 | * ``export JULIA_LLVM_ARGS = -print-after-all`` dumps IR after each pass. 78 | 79 | * ``export JULIA_LLVM_ARGS = -debug-only=loop-vectorize`` dumps LLVM ``DEBUG(...)`` 80 | diagnostics for loop vectorizer *if* you built Julia with ``LLVM_ASSERTIONS=1``. 81 | Otherwise you will get warnings about "Unknown command line argument". 82 | Counter-intuitively, building Julia with ``LLVM_DEBUG=1`` is *not* enough to 83 | dump ``DEBUG`` diagnostics from a pass. 84 | 85 | Improving LLVM optimizations for Julia 86 | -------------------------------------- 87 | 88 | Improving LLVM code generation usually involves either changing Julia lowering 89 | to be more friendly to LLVM's passes, or improving a pass. 90 | 91 | If you are planning to improve a pass, be sure to read the 92 | `LLVM developer policy `_. 93 | The best strategy is to create a code example in a form where you can use LLVM's 94 | ``opt`` tool to study it and the pass of interest in isolation. 95 | 96 | 1. Create an example Julia code of interest. 97 | 98 | 2. Use ``JULIA_LLVM_ARGS = -print-after-all`` to dump the IR. 99 | 100 | 3. Pick out the IR at the point just before the pass of interest runs. 101 | 102 | 4. Strip the debug metadata and fix up the TBAA metadata by hand. 103 | 104 | The last step is labor intensive. Suggestions on a better way would be appreciated. 105 | 106 | -------------------------------------------------------------------------------- /devdocs/meta.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. _devdocs-meta: 4 | 5 | Talking to the compiler (the ``:meta`` mechanism) 6 | ================================================= 7 | 8 | In some circumstances, one might wish to provide hints or instructions 9 | that a given block of code has special properties: you might always 10 | want to inline it, or you might want to turn on special compiler 11 | optimization passes. Starting with version 0.4, julia has a 12 | convention that these instructions can be placed inside a ``:meta`` 13 | expression, which is typically (but not necessarily) the first 14 | expression in the body of a function. 15 | 16 | ``:meta`` expressions are created with macros. As an example, consider 17 | the implementation of the ``@inline`` macro:: 18 | 19 | macro inline(ex) 20 | esc(_inline(ex)) 21 | end 22 | 23 | _inline(ex::Expr) = pushmeta!(ex, :inline) 24 | _inline(arg) = arg 25 | 26 | Here, ``ex`` is expected to be an expression defining a function. 27 | A statement like this:: 28 | 29 | @inline function myfunction(x) 30 | x*(x+3) 31 | end 32 | 33 | gets turned into an expression like this:: 34 | 35 | quote 36 | function myfunction(x) 37 | Expr(:meta, :inline) 38 | x*(x+3) 39 | end 40 | end 41 | 42 | ``pushmeta!(ex, :symbol, args...)`` appends ``:symbol`` to the end of 43 | the ``:meta`` expression, creating a new ``:meta`` expression if 44 | necessary. If ``args`` is specified, a nested expression containing 45 | ``:symbol`` and these arguments is appended instead, which can be used 46 | to specify additional information. 47 | 48 | To use the metadata, you have to parse these ``:meta`` expressions. 49 | If your implementation can be performed within Julia, ``popmeta!`` is 50 | very handy: ``popmeta!(body, :symbol)`` will scan a function *body* 51 | expression (one without the function signature) for a ``:meta`` 52 | expression, extract any arguments, and return a tuple ``(found::Bool, 53 | args::Array{Any})``. If the metadata did not have any arguments, or 54 | ``:symbol`` was not found, the ``args`` array will be empty. 55 | 56 | Not yet provided is a convenient infrastructure for parsing ``:meta`` 57 | expressions from C++. 58 | -------------------------------------------------------------------------------- /devdocs/promote-op.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. _devdocs-promote-op: 4 | 5 | Operator-sensitive promotion 6 | ============================ 7 | 8 | In certain cases, the :ref:`simple rules for promotion 9 | ` may not be sufficient. For example, consider a 10 | type that can represent an object with physical units, here restricted 11 | to a single unit like "meter":: 12 | 13 | immutable MeterUnits{T,P} <: Number 14 | val::T 15 | end 16 | MeterUnits{T}(val::T, pow::Int) = MeterUnits{T,pow}(val) 17 | 18 | m = MeterUnits(1.0, 1) # 1.0 meter, i.e. units of length 19 | m2 = MeterUnits(1.0, 2) # 1.0 meter^2, i.e. units of area 20 | 21 | Now let's define the operations ``+`` and ``*`` for these objects: 22 | ``m+m`` should have the type of ``m`` but ``m*m`` should have the type 23 | of ``m2``. When the result type depends on the operation, and not 24 | just the input types, ``promote_rule`` will be inadequate. 25 | 26 | Fortunately, it's possible to provide such definitions via ``promote_op``:: 27 | 28 | Base.promote_op{R,S}(::Base.AddFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),1} 29 | Base.promote_op{R,S}(::Base.MulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2} 30 | Base.promote_op{R,S}(::Base.DotMulFun, ::Type{MeterUnits{R,1}}, ::Type{MeterUnits{S,1}}) = MeterUnits{promote_type(R,S),2} 31 | 32 | The first one defines the promotion rule for ``+``, and the second one 33 | for ``*``. ``AddFun``, ``MulFun``, and ``DotMulFun`` are "functor 34 | types" defined in `functor.jl 35 | `_. 36 | 37 | It's worth noting that as julia's internal representation of functions 38 | evolves, this interface may change in a future version of Julia. 39 | -------------------------------------------------------------------------------- /devdocs/reflection.rst: -------------------------------------------------------------------------------- 1 | **************************** 2 | Reflection and introspection 3 | **************************** 4 | 5 | .. currentmodule:: Base 6 | 7 | Julia provides a variety of runtime reflection capabilities. 8 | 9 | .. rubric:: Module bindings 10 | 11 | The exported names for a :obj:`Module` are available using :func:`names(m::Module) `, which will return 12 | an array of :obj:`Symbol` elements representing the exported bindings. 13 | ``names(m::Module, true)`` returns symbols for all bindings in ``m``, regardless of export status. 14 | 15 | .. rubric:: DataType fields 16 | 17 | The names of :obj:`DataType` fields may be interrogated 18 | using :func:`fieldnames`. For example, given the following type, ``fieldnames(Point)`` returns an arrays of :obj:`Symbol` 19 | elements representing the field names: 20 | 21 | .. doctest:: 22 | 23 | julia> type Point 24 | x::Int 25 | y 26 | end 27 | 28 | julia> fieldnames(Point) 29 | 2-element Array{Symbol,1}: 30 | :x 31 | :y 32 | 33 | The type of each field in a ``Point`` object is stored in the ``types`` field of the ``Point`` variable itself: 34 | 35 | .. doctest:: 36 | 37 | julia> Point.types 38 | svec(Int64,Any) 39 | 40 | While ``x`` is annotated as an ``Int``, ``y`` was unannotated in the type definition, therefore ``y`` defaults to the ``Any`` type. 41 | 42 | Types are themselves represented as a structure called :obj:`DataType`: 43 | 44 | .. doctest:: 45 | 46 | julia> typeof(Point) 47 | DataType 48 | 49 | Note that ``fieldnames(DataType)`` gives the names for each field of :obj:`DataType` itself, and 50 | one of these fields is the ``types`` field observed in the example above. 51 | 52 | .. rubric:: Subtypes 53 | 54 | The *direct* subtypes of any :obj:`DataType` may be listed using 55 | :func:`subtypes`. For example, the abstract :obj:`DataType` :obj:`AbstractFloat` 56 | has four (concrete) subtypes: 57 | 58 | .. doctest:: 59 | 60 | julia> subtypes(AbstractFloat) 61 | 4-element Array{Any,1}: 62 | BigFloat 63 | Float16 64 | Float32 65 | Float64 66 | 67 | Any abstract subtype will also be included in this list, but further subtypes 68 | thereof will not; recursive application of :func:`subtypes` may be used to inspect 69 | the full type tree. 70 | 71 | .. rubric:: DataType layout 72 | 73 | The internal representation of a :obj:`DataType` is critically important when interfacing with 74 | C code and several functions are available to inspect these details. 75 | :func:`isbits(T::DataType) ` returns true if ``T`` is 76 | stored with C-compatible alignment. 77 | :func:`fieldoffsets(T::DataType) ` returns the (byte) offset for each 78 | field relative to the start of the type. 79 | 80 | .. rubric:: Function methods 81 | 82 | The methods of any generic function may be listed using :func:`methods`. The method dispatch 83 | table may be searched for methods accepting a given type using :func:`methodswith`. 84 | 85 | .. rubric:: Expansion and lowering 86 | 87 | As discussed in the :ref:`Metaprogramming ` section, the 88 | :func:`macroexpand` function gives the unquoted and interpolated expression (``Expr``) form 89 | for a given macro. To use ``macroexpand``, ``quote`` the expression block itself (otherwise, 90 | the macro will be evaluated and the result will be passed instead!). For example: 91 | 92 | .. doctest:: 93 | 94 | julia> macroexpand( :(@edit println("")) ) 95 | :(Base.edit(println,(Base.typesof)(""))) 96 | 97 | The functions :func:`Base.Meta.show_sexpr` and :func:`dump` are used to display S-expr style views 98 | and depth-nested detail views for any expression. 99 | 100 | Finally, the :func:`expand` function gives the ``lowered`` form of any expression and is of particular 101 | interest for understanding both macros and top-level statements such as function declarations and 102 | variable assignments: 103 | 104 | .. doctest:: 105 | 106 | julia> expand( :(f() = 1) ) 107 | :($(Expr(:method, :f, :((top(svec))((top(apply_type))(Tuple),(top(svec))())), AST(:($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin # none, line 1: 108 | return 1 109 | end))))), false))) 110 | 111 | .. rubric:: Intermediate and compiled representations 112 | 113 | Inspecting the lowered form for functions requires selection of the specific method to display, 114 | because generic functions may have many methods with different type signatures. For this purpose, 115 | method-specific code-lowering is available using :func:`code_lowered(f::Function, (Argtypes...)) `, 116 | and the type-inferred form is available using :func:`code_typed(f::Function, (Argtypes...)) `. 117 | :func:`code_warntype(f::Function, (Argtypes...)) ` adds 118 | highlighting to the output of :func:`code_typed` (see :ref:`man-code-warntype`). 119 | 120 | Closer to the machine, the LLVM intermediate representation of a function may be printed using by 121 | :func:`code_llvm(f::Function, (Argtypes...)) `, and finally the compiled machine code is 122 | available using :func:`code_native(f::Function, (Argtypes...) ` (this will trigger JIT 123 | compilation/code generation for any function which has not previously been called). 124 | 125 | For convenience, there are macro versions of the above functions which take standard function calls 126 | and expand argument types automatically:: 127 | 128 | julia> @code_llvm +(1,1) 129 | 130 | ; Function Attrs: sspreq 131 | define i64 @"julia_+_130862"(i64, i64) #0 { 132 | top: 133 | %2 = add i64 %1, %0, !dbg !8 134 | ret i64 %2, !dbg !8 135 | } 136 | 137 | .. not testable due to name variations 138 | 139 | (likewise ``@code_typed``, ``@code_warntype``, ``@code_lowered``, and ``@code_native``) 140 | -------------------------------------------------------------------------------- /devdocs/stdio.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | .. highlight:: c 4 | 5 | *************************************** 6 | printf() and stdio in the Julia runtime 7 | *************************************** 8 | 9 | .. _dev-libuv: 10 | 11 | Libuv wrappers for stdio 12 | ------------------------ 13 | 14 | ``julia.h`` defines `libuv `_ wrappers for the 15 | ``stdio.h`` streams:: 16 | 17 | uv_stream_t *JL_STDIN; 18 | uv_stream_t *JL_STDOUT; 19 | uv_stream_t *JL_STDERR; 20 | 21 | ... and corresponding output functions:: 22 | 23 | int jl_printf(uv_stream_t *s, const char *format, ...); 24 | int jl_vprintf(uv_stream_t *s, const char *format, va_list args); 25 | 26 | These ``printf`` functions are used by :code:`julia/{src,ui}/*.c` wherever stdio 27 | is needed to ensure that output buffering is handled in a unified 28 | way. 29 | 30 | In special cases, like signal handlers, where the full ``libuv`` 31 | infrastructure is too heavy, :func:`jl_safe_printf` can be used to 32 | :func:`write(2) ` directly to :data:`STDERR_FILENO`:: 33 | 34 | void jl_safe_printf(const char *str, ...); 35 | 36 | 37 | 38 | Interface between JL_STD* and Julia code 39 | ---------------------------------------- 40 | 41 | :data:`Base.STDIN`, :data:`Base.STDOUT` and :data:`Base.STDERR` are 42 | bound to the :code:`JL_STD*` `libuv `_ streams 43 | defined in the runtime. 44 | 45 | Julia's :c:func:`__init__` function (in ``base/sysimg.jl``) calls 46 | :c:func:`reinit_stdio` (in ``base/stream.jl``) to create Julia objects 47 | for :data:`Base.STDIN`, :data:`Base.STDOUT` and :data:`Base.STDERR`. 48 | 49 | :c:func:`reinit_stdio` uses :func:`ccall` to retrieve pointers to 50 | :code:`JL_STD*` and calls :c:func:`jl_uv_handle_type` to inspect 51 | the type of each stream. It then creates a Julia :obj:`Base.File`, 52 | :obj:`Base.TTY` or :obj:`Base.Pipe` object to represent each 53 | stream, e.g.: 54 | 55 | .. code-block:: sh 56 | 57 | $ julia -e 'typeof((STDIN, STDOUT, STDERR))' 58 | (TTY,TTY,TTY) 59 | 60 | $ julia -e 'println(typeof((STDIN, STDOUT, STDERR)))' < /dev/null 2>/dev/null 61 | (Base.FS.File,TTY,Base.FS.File) 62 | 63 | $ echo hello | julia -e 'println(typeof((STDIN, STDOUT, STDERR)))' | cat 64 | (Pipe,Pipe,TTY) 65 | 66 | The :func:`Base.read` and :func:`Base.write` methods for these 67 | streams use :func:`ccall` to call ``libuv`` wrappers in :code:`src/jl_uv.c`, e.g.:: 68 | 69 | stream.jl: function write(s::AsyncStream, p::Ptr, nb::Integer) 70 | -> ccall(:jl_uv_write, ...) 71 | jl_uv.c: -> int jl_uv_write(uv_stream_t *stream, ...) 72 | -> uv_write(uvw, stream, buf, ...) 73 | 74 | printf() during initialisation 75 | ------------------------------ 76 | 77 | The ``libuv`` streams relied upon by :c:func:`jl_printf` etc., are not 78 | available until midway through initialisation of the runtime (see 79 | ``init.c``, :c:func:`init_stdio`). Error messages or warnings that need 80 | to be printed before this are routed to the standard C library 81 | :c:func:`fwrite` function by the following mechanism: 82 | 83 | In ``sys.c``, the :code:`JL_STD*` stream pointers are statically initialised 84 | to integer constants: ``STD*_FILENO (0, 1 and 2)``. In ``jl_uv.c`` the 85 | :c:func:`jl_write` function checks its :code:`uv_stream_t* stream` 86 | argument and calls :c:func:`fwrite` if stream is set to :c:macro:`STDOUT_FILENO` 87 | or :c:macro:`STDERR_FILENO`. 88 | 89 | This allows for uniform use of :c:func:`jl_printf` throughout the 90 | runtime regardless of whether or not any particular piece of code 91 | is reachable before initialisation is complete. 92 | 93 | 94 | .. _dev-ios: 95 | 96 | Legacy ios.c library 97 | -------------------- 98 | 99 | The :code:`julia/src/support/ios.c` library is inherited from `femtolisp `_. 100 | It provides cross-platform buffered file IO and in-memory temporary buffers. 101 | 102 | :code:`ios.c` is still used by: 103 | 104 | - :code:`julia/src/flisp/*.c` 105 | - :code:`julia/src/dump.c` -- for serialisation file IO and for memory buffers. 106 | - :code:`base/iostream.jl` -- for file IO (see :code:`base/fs.jl` for ``libuv`` equivalent). 107 | 108 | Use of :code:`ios.c` in these modules is mostly self-contained and 109 | separated from the ``libuv`` I/O system. However, there is `one place 110 | `_ 111 | where femtolisp calls through to :c:func:`jl_printf` with a legacy :c:type:`ios_t` stream. 112 | 113 | There is a hack in :code:`ios.h` that makes the :c:member:`ios_t.bm` 114 | field line up with the :code:`uv_stream_t.type` and ensures that 115 | the values used for :code:`ios_t.bm` to not overlap with valid 116 | UV_HANDLE_TYPE values. This allows :c:type:`uv_stream_t` pointers 117 | to point to :c:type:`ios_t` streams. 118 | 119 | This is needed because :c:func:`jl_printf` caller :c:func:`jl_static_show` 120 | is passed an :code:`ios_t` stream by femtolisp's :c:func:`fl_print` function. 121 | Julia's :c:func:`jl_write` function has special handling for this:: 122 | 123 | if (stream->type > UV_HANDLE_TYPE_MAX) { 124 | return ios_write((ios_t*)stream, str, n); 125 | } 126 | -------------------------------------------------------------------------------- /devdocs/sysimg.rst: -------------------------------------------------------------------------------- 1 | ********************* 2 | System Image Building 3 | ********************* 4 | 5 | .. _dev-sysimg: 6 | 7 | Building the Julia system image 8 | ------------------------------- 9 | 10 | Julia ships with a preparsed system image containing the contents of the ``Base`` module, named ``sys.ji``. This file is also precompiled into a shared library called ``sys.{so,dll,dylib}`` on as many platforms as possible, so as to give vastly improved startup times. On systems that do not ship with a precompiled system image file, one can be generated from the source files shipped in Julia's ``DATAROOTDIR/julia/base`` folder. 11 | 12 | This operation is useful for multiple reasons. A user may: 13 | 14 | * Build a precompiled shared library system image on a platform that did not ship with one, thereby improving startup times. 15 | 16 | * Modify ``Base``, rebuild the system image and use the new ``Base`` next time Julia is started. 17 | 18 | * Include a ``userimg.jl`` file that includes packages into the system image, thereby creating a system image that has packages embedded into the startup environment. 19 | 20 | Julia now ships with a script that automates the tasks of building the system image, wittingly named ``build_sysimg.jl`` that lives in ``DATAROOTDIR/julia/``. That is, to include it into a current Julia session, type: 21 | :: 22 | 23 | include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "build_sysimg.jl")) 24 | 25 | This will include a ``build_sysimg()`` function: 26 | 27 | .. function:: build_sysimg(sysimg_path=default_sysimg_path, cpu_target="native", userimg_path=nothing; force=false) 28 | 29 | Rebuild the system image. Store it in ``sysimg_path``, which defaults to a file named ``sys.ji`` that sits in the same folder as ``libjulia.{so,dylib}``, except on Windows where it defaults to ``JULIA_HOME/../lib/julia/sys.ji``. 30 | Use the cpu instruction set given by ``cpu_target``. Valid CPU targets are the same as for the ``-C`` option to ``julia``, or the ``-march`` option to ``gcc``. Defaults to ``native``, which means to use all CPU instructions available on the current processor. 31 | Include the user image file given by ``userimg_path``, which should contain directives such as ``using MyPackage`` to include that package in the new system image. 32 | New system image will not replace an older image unless ``force`` is set to true. 33 | 34 | Note that this file can also be run as a script itself, with command line arguments taking the place of arguments passed to the ``build_sysimg`` function. For example, to build a system image in ``/tmp/sys.{so,dll,dylib}``, with the ``core2`` CPU instruction set, a user image of ``~/userimg.jl`` and ``force`` set to ``true``, one would execute: 35 | :: 36 | 37 | julia build_sysimg.jl /tmp/sys core2 ~/userimg.jl --force 38 | -------------------------------------------------------------------------------- /devdocs/valgrind.rst: -------------------------------------------------------------------------------- 1 | ************************* 2 | Using Valgrind with Julia 3 | ************************* 4 | 5 | `Valgrind `_ is a tool for memory debugging, memory leak detection, and profiling. This section describes things to keep in mind when using Valgrind to debug memory issues with Julia. 6 | 7 | General considerations 8 | ---------------------- 9 | 10 | By default, Valgrind assumes that there is no self modifying code in the programs it runs. This assumption works fine in most instances but fails miserably for a just-in-time compiler like ``julia``. For this reason it is crucial to pass ``--smc-check=all-non-file`` to ``valgrind``, else code may crash or behave unexpectedly (often in subtle ways). 11 | 12 | In some cases, to better detect memory errors using Valgrind it can help to compile ``julia`` with memory pools disabled. The compile-time flag ``MEMDEBUG`` disables memory pools in Julia, and ``MEMDEBUG2`` disables memory pools in FemtoLisp. To build ``julia`` with both flags, add the following line to ``Make.user``:: 13 | 14 | CFLAGS = -DMEMDEBUG -DMEMDEBUG2 15 | 16 | Another thing to note: if your program uses multiple workers processes, it is likely that you want all such worker processes to run under Valgrind, not just the parent process. To do this, pass ``--trace-children=yes`` to ``valgrind``. 17 | 18 | Suppressions 19 | ------------ 20 | 21 | Valgrind will typically display spurious warnings as it runs. To reduce the number of such warnings, it helps to provide a `suppressions file `_ to Valgrind. A sample suppressions file is included in the Julia source distribution at ``contrib/valgrind-julia.supp``. 22 | 23 | The suppressions file can be used from the ``julia/`` source directory as follows:: 24 | 25 | $ valgrind --smc-check=all-non-file --suppressions=contrib/valgrind-julia.supp ./julia progname.jl 26 | 27 | Any memory errors that are displayed should either be reported as bugs or contributed as additional suppressions. Note that some versions of Valgrind are `shipped with insufficient default suppressions `_, so that may be one thing to consider before submitting any bugs. 28 | 29 | Running the Julia test suite under Valgrind 30 | ------------------------------------------- 31 | 32 | It is possible to run the entire Julia test suite under Valgrind, but it does take quite some time (typically several hours). To do so, run the following command from the ``julia/test/`` directory:: 33 | 34 | valgrind --smc-check=all-non-file --trace-children=yes --suppressions=$PWD/../contrib/valgrind-julia.supp ../julia runtests.jl all 35 | 36 | If you would like to see a report of "definite" memory leaks, pass the flags ``--leak-check=full --show-leak-kinds=definite`` to ``valgrind`` as well. 37 | 38 | Caveats 39 | ------- 40 | 41 | Valgrind currently `does not support multiple rounding modes `_, so code that adjusts the rounding mode will behave differently when run under Valgrind. 42 | 43 | In general, if after setting ``--smc-check=all-non-file`` you find that your program behaves differently when run under Valgrind, it may help to pass ``--tool=none`` to ``valgrind`` as you investigate further. This will enable the minimal Valgrind machinery but will also run much faster than when the full memory checker is enabled. 44 | -------------------------------------------------------------------------------- /images/github_metadata_develbranch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaTokyo/julia-doc-ja/8495691bf079c5c9c7d1b3546c217634873be1d3/images/github_metadata_develbranch.png -------------------------------------------------------------------------------- /images/github_metadata_fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaTokyo/julia-doc-ja/8495691bf079c5c9c7d1b3546c217634873be1d3/images/github_metadata_fork.png -------------------------------------------------------------------------------- /images/github_metadata_pullrequest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaTokyo/julia-doc-ja/8495691bf079c5c9c7d1b3546c217634873be1d3/images/github_metadata_pullrequest.png -------------------------------------------------------------------------------- /images/jltypes.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaTokyo/julia-doc-ja/8495691bf079c5c9c7d1b3546c217634873be1d3/images/jltypes.ai -------------------------------------------------------------------------------- /images/travis-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JuliaTokyo/julia-doc-ja/8495691bf079c5c9c7d1b3546c217634873be1d3/images/travis-icon.png -------------------------------------------------------------------------------- /index.rst: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%% 3 | Julia ドキュメント 4 | %%%%%%%%%%%%%%%%%%%%% 5 | 6 | * :ref:`manual` 7 | * :ref:`stdlib` 8 | * :ref:`devdocs` 9 | 10 | .. _manual: 11 | 12 | ######## 13 | マニュアル 14 | ######## 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | 19 | manual/introduction 20 | manual/getting-started 21 | manual/variables 22 | manual/integers-and-floating-point-numbers 23 | manual/mathematical-operations 24 | manual/complex-and-rational-numbers 25 | manual/strings 26 | manual/functions 27 | manual/control-flow 28 | manual/variables-and-scoping 29 | manual/types 30 | manual/methods 31 | manual/constructors 32 | manual/conversion-and-promotion 33 | manual/interfaces 34 | manual/modules 35 | manual/documentation 36 | manual/metaprogramming 37 | manual/arrays 38 | manual/linear-algebra 39 | manual/networking-and-streams 40 | manual/parallel-computing 41 | manual/dates 42 | manual/running-external-programs 43 | manual/calling-c-and-fortran-code 44 | manual/interacting-with-julia 45 | manual/embedding 46 | manual/packages 47 | manual/profile 48 | manual/performance-tips 49 | manual/workflow-tips 50 | manual/style-guide 51 | manual/faq 52 | manual/noteworthy-differences 53 | manual/unicode-input 54 | 55 | .. _stdlib: 56 | 57 | ################## 58 | 標準ライブラリ 59 | ################## 60 | 61 | .. toctree:: 62 | :maxdepth: 1 63 | 64 | stdlib/base 65 | stdlib/collections 66 | stdlib/math 67 | stdlib/numbers 68 | stdlib/strings 69 | stdlib/arrays 70 | stdlib/parallel 71 | stdlib/linalg 72 | stdlib/constants 73 | stdlib/file 74 | stdlib/io-network 75 | stdlib/punctuation 76 | stdlib/sort 77 | stdlib/pkg 78 | stdlib/dates 79 | stdlib/test 80 | stdlib/c 81 | stdlib/profile 82 | 83 | .. _devdocs: 84 | 85 | ####################### 86 | 開発者向けドキュメント 87 | ####################### 88 | 89 | .. toctree:: 90 | :maxdepth: 2 91 | 92 | devdocs/reflection 93 | devdocs/julia 94 | devdocs/C 95 | -------------------------------------------------------------------------------- /latex.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | %%%%%%%%%%%%%%%%%%%%% 4 | Julia Documentation 5 | %%%%%%%%%%%%%%%%%%%%% 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | manual/index 11 | stdlib/index 12 | 13 | -------------------------------------------------------------------------------- /man/julia.1: -------------------------------------------------------------------------------- 1 | .\" To get a preview of the man page as it will actually be displayed, run 2 | .\" 3 | .\" > nroff -man julia.1 | less 4 | .\" 5 | .\" at the terminal. 6 | .\" 7 | .\" Suggestions and improvements very much appreciated! 8 | .\" Nothing is too large or too small. 9 | .\" This man page was largely taken from pre-existing sources of documentation. 10 | .\" This is documented by comments in the man page's source. 11 | .\" 12 | .\" # TODOs: 13 | .\" 1. Simple, hopefully portable way to get the man page on everyone's manpath. 14 | .\" (The whole point was to be able to simply `man julia`!) 15 | .\" 16 | .\" Possible sections to add to man page: 17 | .\" - licensing 18 | .\" - internet resources and/or documentation 19 | .\" - environment 20 | .\" - see also 21 | .\" - diagnostics 22 | .\" - notes 23 | 24 | .TH JULIA 1 2013-12-10 Julia "Julia Programmers' Reference Guide" 25 | 26 | .\" from the front page of http://julialang.org/ 27 | .SH NAME 28 | julia - high-level, high-performance dynamic programming language for technical computing 29 | 30 | .SH SYNOPSIS 31 | julia [option] [program] [args..] 32 | 33 | .\" Taken almost verbatim from the front page of http://julialang.org/ 34 | .SH DESCRIPTION 35 | Julia is a high-level, high-performance dynamic programming language 36 | for technical computing, with syntax that is familiar to users 37 | of other technical computing environments. 38 | It provides a sophisticated compiler, distributed parallel execution, 39 | numerical accuracy, and an extensive mathematical function library. 40 | The library, largely written in Julia itself, also integrates mature, 41 | best-of-breed C and Fortran libraries for linear algebra, 42 | random number generation, signal processing, and string processing. 43 | In addition, the Julia developer community is contributing a number of 44 | external packages through Julia's built-in package manager at a rapid pace. 45 | Julia programs are organized around multiple dispatch; 46 | by defining functions and overloading them for different combinations 47 | of argument types, which can also be user-defined. 48 | For a more in-depth discussion of the rationale and advantages of Julia 49 | over other systems, please see the online manual: 50 | http://docs.julialang.org/en/latest/manual/ 51 | 52 | If a Julia source file is given as a \fIprogram\fP (optionally followed by 53 | arguments in \fIargs\fP) Julia will execute the program and exit. 54 | 55 | .\" This section was taken nearly verbatim from the output of `julia --help` 56 | .SH "COMMAND-LINE OPTIONS" 57 | .TP 25 58 | 59 | .TP 60 | -v, --version 61 | Display version information 62 | 63 | .TP 64 | -h, --help 65 | Print help message 66 | 67 | .TP 68 | -q, --quiet 69 | Quiet startup without banner 70 | 71 | .TP 72 | -H, --home 73 | Set location of julia executable 74 | 75 | .TP 76 | -e, --eval 77 | Evaluate 78 | 79 | .TP 80 | -E, --print 81 | Evaluate and show 82 | 83 | .TP 84 | -P, --post-boot 85 | Evaluate , but don't disable interactive mode 86 | 87 | .TP 88 | -L, --load 89 | Load immediately on all processors 90 | 91 | .TP 92 | -J, --sysimage 93 | Start up with the given system image file 94 | 95 | .TP 96 | -C, --cpu-target 97 | Limit usage of cpu features up to 98 | 99 | .TP 100 | -p, --procs 101 | Run n local processes 102 | 103 | .TP 104 | --machinefile 105 | Run processes on hosts listed in 106 | 107 | .TP 108 | -i 109 | Force isinteractive() to be true 110 | 111 | .TP 112 | --color={yes|no} 113 | Enable or disable color text 114 | 115 | .TP 116 | --history-file={yes|no} 117 | Load or save history 118 | 119 | .TP 120 | --startup-file={yes|no} 121 | Load ~/.juliarc.jl 122 | 123 | .TP 124 | --compile={yes|no|all} 125 | Enable or disable compiler, or request exhaustive compilation 126 | 127 | .TP 128 | --code-coverage={none|user|all}, --code-coverage 129 | Count executions of source lines (omitting setting is equivalent to 'user') 130 | 131 | .TP 132 | --track-allocation={none|user|all}, --track-allocation 133 | Count bytes allocated by each source line 134 | 135 | .TP 136 | -O, --optimize 137 | Run time-intensive code optimizations 138 | 139 | .TP 140 | --check-bounds={yes|no} 141 | Emit bounds checks always or never (ignoring declarations) 142 | 143 | .TP 144 | --dump-bitcode={yes|no} 145 | Dump bitcode for the system image (used with --build) 146 | 147 | .TP 148 | --depwarn={yes|no|error} 149 | Enable or disable syntax and method deprecation warnings ('error' turns warnings into errors) 150 | 151 | .TP 152 | --inline={yes|no} 153 | Control whether inlining is permitted (overrides functions declared as @inline) 154 | 155 | .TP 156 | --math-mode={ieee|user} 157 | Always use IEEE semantics for math (ignoring declarations), 158 | or adhere to declarations in source code 159 | 160 | .SH FILES 161 | .I ~/.juliarc.jl 162 | .RS 163 | Per user startup file. 164 | .RE 165 | 166 | .I /etc/julia/juliarc.jl 167 | .RS 168 | System-wide startup file. 169 | .RE 170 | 171 | .SH BUGS 172 | Please report any bugs using the GitHub issue tracker: 173 | https://github.com/julialang/julia/issues?state=open 174 | 175 | .SH AUTHORS 176 | Contributors: https://github.com/JuliaLang/julia/graphs/contributors 177 | -------------------------------------------------------------------------------- /manual/getting-started.rst: -------------------------------------------------------------------------------- 1 | .. _man-getting-started: 2 | 3 | ***************** 4 | 始めよう 5 | ***************** 6 | 7 | コンパイル済のバイナリを使うのであれ、ソースからコンパイルするのであれ、Juliaのインストールは簡単です。`http://julialang.org/downloads/ `_ にある手順に従い、Juliaをダウンロードしてインストールしてください。 8 | 9 | Juliaを学んだり試したりする一番簡単な方法は、インタラクティブ・セッション(read-eval-print loop、もしくは"repl"とも呼ばれるものです)を使ったものです。セッションを起動するには、Juliaの実行ファイルをダブルクリックするか、コマンドラインから ``julia`` を実行します。 10 | 11 | :: 12 | 13 | $ julia 14 | _ 15 | _ _ _(_)_ | A fresh approach to technical computing 16 | (_) | (_) (_) | Documentation: http://docs.julialang.org 17 | _ _ _| |_ __ _ | Type "?help" for help. 18 | | | | | | | |/ _` | | 19 | | | |_| | | | (_| | | Version 0.4.2 (2015-12-06 21:47 UTC) 20 | _/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release 21 | |__/ | x86_64-apple-darwin13.4.0 22 | 23 | julia> 1 + 2 24 | 3 25 | 26 | julia> ans 27 | 3 28 | 29 | インタラクティブ・セッションを終了するには、``^D`` — コントロールキーと ``d`` キーを同時に押す — もしくは、 ``quit()`` と入力してください。インタラクティブ・モードで起動すると、 ``julia`` のバナーが表示され、プロンプトがユーザーの入力を待ちます。ユーザーが完全な式、例えば ``1 + 2`` を入力し、エンターキーを押すと、その式が評価され、値が表示されます。式の後ろにセミコロンをつけて入力すると、値は表示されません。``ans`` という変数は、最後に評価された式の値(それが表示されたか否かに関わらず)に束縛されています。``ans`` はインタラクティブ・セッションでのみ利用可能で、他の方法でJuliaのコードが実行された際には使うことができません。 30 | 31 | ``file.jl`` というソースファイルに書かれた式を評価するには、 ``include("file.jl")`` と書きます。 32 | 33 | ファイルに書かれたコードをインタラクティブではない方法で実行するには、以下のようにファイル名をjuliaコマンドの第1引数とします。 34 | 35 | :: 36 | 37 | $ julia script.jl arg1 arg2... 38 | 39 | 40 | 上の例が示すように、後ろの引数は ``script.jl`` というプログラムのコマンドライン引数として取られ、 グローバル定数 ``ARGS`` に渡されます。コマンドラインで ``-e`` オプションが設定された際にも ``ARGS`` は設定されます(下の ``julia`` ヘルプ出力を参照してください)。例えば以下のようにすることで、スクリプトに渡された引数を単純に出力することができます。 41 | 42 | :: 43 | 44 | $ julia -e 'for x in ARGS; println(x); end' foo bar 45 | foo 46 | bar 47 | 48 | もしくは、上のコードをスクリプトに書いて実行することもできます。 49 | 50 | :: 51 | 52 | $ echo 'for x in ARGS; println(x); end' > script.jl 53 | $ julia script.jl foo bar 54 | foo 55 | bar 56 | 57 | ``-p`` もしくは ``--machinefile`` オプションを設定することで、Juliaを並列モードで開始することができます。``-p n`` でn個のワーカーを追加で起動することができ、 ``--machinefile file`` では ``file`` ファイルの各行ごとにワーカーが起動されます。``file`` で定義されたマシンは、パスワード無しで ``ssh`` アクセスでき、現在のホストと同じ場所にJuliaがインストールされている必要があります。各マシンの定義は ``[count*][user@]host[:port] [bind_addr[:port]]`` という形式で書かれます。デフォルトでは、``user`` は現在のユーザー、 ``port`` は標準のsshポートになります。``count`` はノードで作成されるワーカーの数で、デフォルトは1です。``bind-to bind_addr[:port]`` オプションを指定すると、他のワーカーがそのワーカーと接続する際に使うIPアドレスとポートを設定することもできます。 58 | 59 | Juliaの起動時に毎回実行したいコードがあれば、 ``~/.juliarc.jl`` に書いておくことができます。 60 | 61 | .. raw:: latex 62 | 63 | \begin{CJK*}{UTF8}{mj} 64 | 65 | :: 66 | 67 | $ echo 'println("Greetings! 你好! 안녕하세요?")' > ~/.juliarc.jl 68 | $ julia 69 | Greetings! 你好! 안녕하세요? 70 | 71 | ... 72 | 73 | .. raw:: latex 74 | 75 | \end{CJK*} 76 | 77 | 他の言語(``perl`` や ``ruby`` など)のように、Juliaを実行するには様々な方法やオプションがあります。 78 | 79 | :: 80 | 81 | julia [options] [program] [args...] 82 | -v, --version Display version information 83 | -h, --help Print this message 84 | -q, --quiet Quiet startup without banner 85 | -H, --home Set location of julia executable 86 | 87 | -e, --eval Evaluate 88 | -E, --print Evaluate and show 89 | -P, --post-boot Evaluate , but don't disable interactive mode 90 | -L, --load Load immediately on all processors 91 | -J, --sysimage Start up with the given system image file 92 | -C, --cpu-target Limit usage of cpu features up to 93 | 94 | -p, --procs {N|auto} Integer value N launches N additional local worker processes 95 | 'auto' launches as many workers as the number of local cores 96 | --machinefile Run processes on hosts listed in 97 | 98 | -i Force isinteractive() to be true 99 | --color={yes|no} Enable or disable color text 100 | 101 | --history-file={yes|no} Load or save history 102 | --no-history-file Don't load history file (deprecated, use --history-file=no) 103 | --startup-file={yes|no} Load ~/.juliarc.jl 104 | -f, --no-startup Don't load ~/.juliarc (deprecated, use --startup-file=no) 105 | -F Load ~/.juliarc (deprecated, use --startup-file=yes) 106 | 107 | --compile={yes|no|all} Enable or disable compiler, or request exhaustive compilation 108 | 109 | --code-coverage={none|user|all}, --code-coverage 110 | Count executions of source lines (omitting setting is equivalent to 'user') 111 | 112 | --track-allocation={none|user|all}, --track-allocation 113 | Count bytes allocated by each source line 114 | 115 | -O, --optimize 116 | Run time-intensive code optimizations 117 | --check-bounds={yes|no} Emit bounds checks always or never (ignoring declarations) 118 | --dump-bitcode={yes|no} Dump bitcode for the system image (used with --build) 119 | --depwarn={yes|no} Enable or disable syntax and method deprecation warnings 120 | --inline={yes|no} Control whether inlining is permitted (overrides functions declared as @inline) 121 | --math-mode={ieee|user} Always use IEEE semantics for math (ignoring declarations), 122 | or adhere to declarations in source code 123 | 124 | 関連資料 125 | ------ 126 | 127 | 新しいユーザーがJuliaを始めるにあたり、このマニュアルの他にも以下のリソースが参考になるでしょう。 128 | 129 | 英語 130 | ^^^^ 131 | 132 | - `Julia and IJulia cheatsheet `_ 133 | - `Learn Julia in a few minutes `_ 134 | - `Tutorial for Homer Reid's numerical analysis class `_ 135 | - `An introductory presentation `_ 136 | - `Videos from the Julia tutorial at MIT `_ 137 | - `Forio Julia Tutorials `_ 138 | 139 | 140 | 日本語 141 | ^^^^^ 142 | 143 | - `Julia高速チュートリアル - bicycle1885 `_ 144 | - `実例で学ぶ Julia-0.4.1 - yomichi `_ 145 | - `Julia Advent Calendar 2014 - Qiita `_ 146 | - `Julia Advent Calendar 2015 - Qiita `_ 147 | - `JuliaTokyo 発表資料 `_ 148 | - `今Juliaを入門するのに良いチュートリアルは? · Issue #3 · JuliaTokyo/julia-wakalang `_ 149 | - `JuliaTokyo/julia-wakalang `_ [#julia-wakalang]_ 150 | 151 | 152 | .. [#julia-wakalang] Juliaに関する質問を日本語で出来る場所。`チャットルーム(Slack) `_ もあります。 153 | -------------------------------------------------------------------------------- /manual/index.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _manual-index: 3 | 4 | ################## 5 | The Julia Manual 6 | ################## 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | introduction 12 | getting-started 13 | variables 14 | integers-and-floating-point-numbers 15 | mathematical-operations 16 | complex-and-rational-numbers 17 | strings 18 | functions 19 | control-flow 20 | variables-and-scoping 21 | types 22 | methods 23 | constructors 24 | conversion-and-promotion 25 | modules 26 | metaprogramming 27 | arrays 28 | linear-algebra 29 | networking-and-streams 30 | parallel-computing 31 | dates 32 | interacting-with-julia 33 | running-external-programs 34 | calling-c-and-fortran-code 35 | embedding 36 | packages 37 | profile 38 | performance-tips 39 | style-guide 40 | faq 41 | noteworthy-differences 42 | unicode-input 43 | -------------------------------------------------------------------------------- /manual/introduction.rst: -------------------------------------------------------------------------------- 1 | .. _man-introduction: 2 | 3 | ************** 4 | はじめに 5 | ************** 6 | 7 | 科学技術計算には常に最高の性能が求められますが、この分野のエキスパートたちはより低速な動的言語を使って仕事をしています。 8 | 私達はこの分野で動的言語を用いることにたくさんの利点があることを理解していますし、動的言語が使われないようにしたいわけでもありません。 9 | 幸い、最近の言語設計やコンパイラの進歩によって、性能の低下を避けつつ、「生産的なプロトタイピング」と「高性能なアプリケーションの効率的なデプロイ」の両方をひとつの環境で提供することが可能になりました。 10 | Juliaはこのような目的のために開発されています。つまり、Juliaは柔軟な動的言語であると同時に、古くからの静的型付け言語と同等の性能を実現することで科学計算や数値計算に適してたものになっています。 11 | 12 | JuliaのコンパイラはPythonやRで使われるようなインタプリタとは異なるので、もしかしたら最初はその性能に気づかないかもしれません。 13 | 遅いと感じたら、何かを試す前に `Performance Tips `_ を参照することをお勧めします。 14 | Juliaがどのように動作するかを理解すれば、C言語と同等の速さで動くコードを簡単に書くことができるでしょう。 15 | 16 | Juliaは任意の型付け、多重ディスパッチ、そして優れた性能を提供します。 17 | これは型推論と、 `LLVM `_ によって実装された `just-in-time (JIT) コンパイラ `_ によって実現されるものです。 18 | Juliaは命令型プログラミング・関数型プログラミング・オブジェクト指向プログラミングの機能を組み合わせたマルチパラダイム言語です。 19 | JuliaはR、MATLAB、Pythonなどと同様に高度な数値計算のための簡単で高い表現力を持つ記法を提供しつつ、一般的なプログラミングもサポートします。 20 | このことを実現するために、Juliaは数値計算言語の系譜を踏まえつつも、 `Lisp `_ 、 21 | `Perl `_ 、 `Python `_ 、 `Lua `_ 、そして 22 | `Ruby `_ などの広く使われている動的言語からも多くのアイデアを得ています。 23 | 24 | 一般の動的言語と比べてJuliaが特に優れている点としては以下のようなものが挙げられます。 25 | 26 | - 言語のコア部分は最小限の機能しか提供しません。整数の四則演算のような初等演算を含む標準ライブラリはJulia自身で書かれています 27 | - オブジェクトを作成したり説明したりするのに使うことができる、型に関する豊富な機能を提供します。プログラマ自身で型を宣言することもできます 28 | - `多重ディスパッチ `_ によってさまざまな引数の組み合わせごとに関数の振る舞いを定義できます 29 | - それぞれの引数の型ごとに最適化されたコードを自動生成します 30 | - Cのような静的コンパイル言語に迫る性能を実現します 31 | 32 | 動的言語は「型がない」と言われることがありますが、そんなことはありません。 33 | プリミティブであれユーザー定義であれ、全てのオブジェクトは何らかの型を持ちます。 34 | 多くの動的言語における型宣言の欠落は、コンパイラに対して値の型を伝えられない、または型について何ら触れることができないということを意味します。 35 | 一方静的言語においては、コンパイラのために型注釈をつけることができます(ほぼ必須でしょう)が、型の情報はコンパイル時にのみ存在し、実行時には操作したり取得したりすることができません。 36 | Juliaでは、型そのものが実行時オブジェクトとなり、同時にコンパイラに対して情報を伝えるために利用できます。 37 | 38 | カジュアルプログラマは型や多重ディスパッチを明示的に使う必要はありませんが、これらはJuliaの基礎となる機能です。 39 | 関数はさまざまな引数の組み合わせに対して定義され、実行時には最も当てはまる定義が適用されます。 40 | このモデルは数値計算にとても適しています。 41 | 従来のオブジェクト指向ディスパッチのように、第一引数が演算子を「所有」するのは不自然です。 42 | これに対してJuliaの演算子は(特殊な記法を持った)単なる関数に過ぎません。 43 | ユーザーが定義したデータ型に対して加算処理を追加したい場合は、 ``+`` 関数に対して新たなメソッドを定義します。 44 | こうすることで、既存のコードをシームレスに新たなデータ型対応させることができます。 45 | 46 | 実行時型推論(任意の型注釈で補うこともできます)によって、またプロジェクト発足時からの性能に対する強い欲求によって、Juliaの計算効率は他の動的言語を圧倒し、静的コンパイル言語と競うレベルにあります。 47 | 大規模数値計算問題では計算速度はこれまでもこれからも、常に重大な問題です。 48 | 処理されるデータ量は過去数十年にわたってムーアの法則にしたがって増え続けています。 49 | 50 | Juliaは、扱いやすさ・強力さ・効率性の前例のない組み合わせを1つの言語で実現しようとしています。これに加え、Juliaは以下のような長所を持ちます。 51 | 52 | - フリーかつオープンソース( `MITライセンス `_ ) 53 | - コンパクトで組み込み型と同等の速度を持つユーザー定義型 54 | - 性能のためにコードをベクトル化する必要がありません。ベクトル化されていないコードも高速に動作します 55 | - 並列コンピューティング・分散コンピューティングを意図した設計 56 | - 軽量で"greenな"スレッドシステム [#green-threads]_ ( `コルーチン `_ ) 57 | - 控えめかつ強力な型システム 58 | - 数値型他の型の、エレガントで拡張性のある変換やプロモーション [#promotion]_ 59 | - `Unicode `_ の効率的なサポート。 `UTF-8 `_ も含みますが、これに限定しません 60 | - ラッパーや特別なAPIを必要としない、Cの関数の直接の呼び出し 61 | - シェルのような強力なプロセス管理 62 | - Lispライクなマクロやその他のメタプログラミング機構 63 | 64 | 65 | .. [#green-threads] 訳注: グリーン・スレッド(Green Threads)とは、OSではなくランタイムライブラリによってスケジュールされるスレッドのこと。対義として「ネイティブ・スレッド」がある。 66 | .. [#promotion] 訳注: プロモーションの詳細については `変換とプロモーション <./conversion-and-promotion.html>`_ を参照のこと。 67 | -------------------------------------------------------------------------------- /manual/unicode-input.rst: -------------------------------------------------------------------------------- 1 | .. _man-unicode-input: 2 | 3 | *************** 4 | Unicode Input 5 | *************** 6 | 7 | .. only:: html 8 | 9 | .. warning:: 10 | This table may appear to contain missing characters in the second column, 11 | or even show characters that are inconsistent with the characters as they 12 | are rendered in the Julia REPL. In these cases, users are strongly 13 | advised to check their choice of fonts in their browser and REPL 14 | environment, as there are known issues with glyphs in many fonts. 15 | 16 | .. include:: unicode-input-table.rst 17 | 18 | .. only:: latex 19 | 20 | Please see the online documentation. 21 | 22 | -------------------------------------------------------------------------------- /manual/variables.rst: -------------------------------------------------------------------------------- 1 | 2 | *********** 3 | Variables 4 | *********** 5 | 6 | A variable, in Julia, is a name associated (or bound) to a value. It's useful when you want to store a value (that you obtained after some math, for example) for later use. For example: 7 | 8 | .. doctest:: 9 | 10 | # Assign the value 10 to the variable x 11 | julia> x = 10 12 | 10 13 | 14 | # Doing math with x's value 15 | julia> x + 1 16 | 11 17 | 18 | # Reassign x's value 19 | julia> x = 1 + 1 20 | 2 21 | 22 | # You can assign values of other types, like strings of text 23 | julia> x = "Hello World!" 24 | "Hello World!" 25 | 26 | Julia provides an extremely flexible system for naming variables. 27 | Variable names are case-sensitive, and have no semantic meaning (that is, 28 | the language will not treat variables differently based on their names). 29 | 30 | .. raw:: latex 31 | 32 | \begin{CJK*}{UTF8}{gbsn} 33 | 34 | .. doctest:: 35 | 36 | julia> x = 1.0 37 | 1.0 38 | 39 | julia> y = -3 40 | -3 41 | 42 | julia> Z = "My string" 43 | "My string" 44 | 45 | julia> customary_phrase = "Hello world!" 46 | "Hello world!" 47 | 48 | julia> UniversalDeclarationOfHumanRightsStart = "人人生而自由,在尊严和权力上一律平等。" 49 | "人人生而自由,在尊严和权力上一律平等。" 50 | 51 | .. raw:: latex 52 | 53 | \end{CJK*} 54 | 55 | Unicode names (in UTF-8 encoding) are allowed: 56 | 57 | .. raw:: latex 58 | 59 | \begin{CJK*}{UTF8}{mj} 60 | 61 | .. doctest:: 62 | 63 | julia> δ = 0.00001 64 | 1.0e-5 65 | 66 | julia> 안녕하세요 = "Hello" 67 | "Hello" 68 | 69 | In the Julia REPL and several other Julia editing environments, you 70 | can type many Unicode math symbols by typing the backslashed LaTeX symbol 71 | name followed by tab. For example, the variable name ``δ`` can be 72 | entered by typing ``\delta``-*tab*, or even ``α̂₂`` by 73 | ``\alpha``-*tab*-``\hat``-*tab*-``\_2``-*tab*. 74 | 75 | .. raw:: latex 76 | 77 | \end{CJK*} 78 | 79 | Julia will even let you redefine built-in constants and functions if needed: 80 | 81 | .. doctest:: 82 | 83 | julia> pi 84 | π = 3.1415926535897... 85 | 86 | julia> pi = 3 87 | WARNING: imported binding for pi overwritten in module Main 88 | 3 89 | 90 | julia> pi 91 | 3 92 | 93 | julia> sqrt(100) 94 | 10.0 95 | 96 | julia> sqrt = 4 97 | WARNING: imported binding for sqrt overwritten in module Main 98 | 4 99 | 100 | However, this is obviously not recommended to avoid potential confusion. 101 | 102 | Allowed Variable Names 103 | ====================== 104 | 105 | Variable names must begin with a letter (A-Z or a-z), underscore, or a 106 | subset of Unicode code points greater than 00A0; in particular, `Unicode character categories`_ Lu/Ll/Lt/Lm/Lo/Nl (letters), Sc/So (currency and 107 | other symbols), and a few other letter-like characters (e.g. a subset 108 | of the Sm math symbols) are allowed. Subsequent characters may also 109 | include ! and digits (0-9 and other characters in categories Nd/No), 110 | as well as other Unicode code points: diacritics and other modifying 111 | marks (categories Mn/Mc/Me/Sk), some punctuation connectors (category 112 | Pc), primes, and a few other characters. 113 | 114 | .. _Unicode character categories: http://www.fileformat.info/info/unicode/category/index.htm 115 | 116 | Operators like ``+`` are also valid identifiers, but are parsed specially. In 117 | some contexts, operators can be used just like variables; for example 118 | ``(+)`` refers to the addition function, and ``(+) = f`` will reassign 119 | it. Most of the Unicode infix operators (in category Sm), 120 | such as ``⊕``, are parsed as infix operators and are available for 121 | user-defined methods (e.g. you can use ``const ⊗ = kron`` to define 122 | ``⊗`` as an infix Kronecker product). 123 | 124 | The only explicitly disallowed names for variables are the names of built-in 125 | statements: 126 | 127 | .. doctest:: 128 | 129 | julia> else = false 130 | ERROR: syntax: unexpected "else" 131 | 132 | julia> try = "No" 133 | ERROR: syntax: unexpected "=" 134 | 135 | 136 | Stylistic Conventions 137 | ===================== 138 | 139 | While Julia imposes few restrictions on valid names, it has become useful to 140 | adopt the following conventions: 141 | 142 | - Names of variables are in lower case. 143 | - Word separation can be indicated by underscores (``'_'``), but use of 144 | underscores is discouraged unless the name would be hard to read otherwise. 145 | - Names of ``Type``\ s and ``Module``\ s begin with a capital letter and word separation is 146 | shown with upper camel case instead of underscores. 147 | - Names of ``function``\ s and ``macro``\s are in lower case, without 148 | underscores. 149 | - Functions that write to their arguments have names that end in ``!``. 150 | These are sometimes called "mutating" or "in-place" functions because 151 | they are intended to produce changes in their arguments after the 152 | function is called, not just return a value. 153 | -------------------------------------------------------------------------------- /manual/workflow-tips.rst: -------------------------------------------------------------------------------- 1 | .. _man-workflow-tips: 2 | 3 | *************** 4 | Workflow Tips 5 | *************** 6 | 7 | Here are some tips for working with Julia efficiently. 8 | 9 | REPL-based workflow 10 | ------------------- 11 | 12 | As already elaborated in :ref:`man-interacting-with-julia`, Julia's 13 | REPL provides rich functionality that facilitates an efficient 14 | interactive workflow. Here are some tips that might further enhance your 15 | experience at the command line. 16 | 17 | A basic editor/REPL workflow 18 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | 20 | The most basic Julia workflows involve using a text editor in 21 | conjunction with the ``julia`` command line. A common pattern includes 22 | the following elements: 23 | 24 | - **Put code under development in a temporary module.** Create a file, 25 | say ``Tmp.jl``, and include within it :: 26 | 27 | module Tmp 28 | 29 | 30 | 31 | end 32 | 33 | - **Put your test code in another file.** Create another file, say 34 | ``tst.jl``, which begins with :: 35 | 36 | import Tmp 37 | 38 | and includes tests for the contents of ``Tmp``. The value of using 39 | :obj:`import` versus :obj:`using` is that you can call :obj:`reload` 40 | ``("Tmp")`` instead of having to restart the REPL when your 41 | definitions change. Of course, the cost is the need to prepend 42 | ``Tmp.`` to uses of names defined in your module. (You can lower that 43 | cost by keeping your module name short.) 44 | 45 | Alternatively, you can wrap the contents of your test file in a 46 | module, as :: 47 | 48 | module Tst 49 | using Tmp 50 | 51 | 52 | 53 | end 54 | 55 | The advantage is that you can now do :obj:`using` ``Tmp`` in your 56 | test code and can therefore avoid prepending ``Tmp.`` everywhere. 57 | The disadvantage is that code can no longer be selectively copied 58 | to the REPL without some tweaking. 59 | 60 | - **Lather. Rinse. Repeat.** Explore ideas at the ``julia`` command 61 | prompt. Save good ideas in ``tst.jl``. Occasionally 62 | restart the REPL, issuing :: 63 | 64 | reload("Tmp") 65 | include("tst.jl") 66 | 67 | Simplify initialization 68 | ~~~~~~~~~~~~~~~~~~~~~~~ 69 | 70 | To simplify restarting the REPL, put project-specific initialization 71 | code in a file, say ``_init.jl``, which you can run on startup by 72 | issuing the command:: 73 | 74 | julia -L _init.jl 75 | 76 | If you further add the following to your ``.juliarc.jl`` file :: 77 | 78 | isinteractive() && isfile("_init.jl") && require("_init.jl") 79 | 80 | then calling ``julia`` from that directory will run the initialization 81 | code without the additional command line argument. 82 | 83 | Browser-based workflow 84 | ---------------------- 85 | 86 | It is also possible to interact with a Julia REPL in the browser via IJulia_. See the package home for details. 87 | 88 | .. _IJulia: https://github.com/JuliaLang/IJulia.jl 89 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | -e git+https://github.com/JuliaLang/JuliaDoc.git@85c83a5c4ecd1716e0aa858d73322cc2058bc7b1#egg=JuliaDoc 2 | -e git+https://github.com/snide/sphinx_rtd_theme.git@21e875d3a53ce897089ad690d897252f6063349d#egg=sphinx_rtd_theme 3 | -------------------------------------------------------------------------------- /stdlib/constants.rst: -------------------------------------------------------------------------------- 1 | .. currentmodule:: Base 2 | 3 | Constants 4 | ========= 5 | 6 | .. data:: nothing 7 | 8 | The singleton instance of type ``Void``, used by convention when there is no value to 9 | return (as in a C ``void`` function). 10 | Can be converted to an empty ``Nullable`` value. 11 | 12 | .. data:: OS_NAME 13 | 14 | A symbol representing the name of the operating system. Possible values 15 | are ``:Linux``, ``:Darwin`` (OS X), or ``:Windows``. 16 | 17 | .. data:: ARGS 18 | 19 | An array of the command line arguments passed to Julia, as strings. 20 | 21 | .. data:: C_NULL 22 | 23 | The C null pointer constant, sometimes used when calling external code. 24 | 25 | .. data:: CPU_CORES 26 | 27 | The number of CPU cores in the system. 28 | 29 | .. data:: WORD_SIZE 30 | 31 | Standard word size on the current machine, in bits. 32 | 33 | .. data:: VERSION 34 | 35 | An object describing which version of Julia is in use. 36 | 37 | .. data:: LOAD_PATH 38 | 39 | An array of paths (as strings) where the ``require`` function looks for code. 40 | 41 | .. data:: JULIA_HOME 42 | 43 | A string containing the full path to the directory containing the ``julia`` executable. 44 | 45 | .. data:: ANY 46 | 47 | Equivalent to ``Any`` for dispatch purposes, but signals the compiler to skip code generation specialization for that field 48 | 49 | See also: 50 | 51 | :data:`STDIN` 52 | :data:`STDOUT` 53 | :data:`STDERR` 54 | :data:`ENV` 55 | :data:`ENDIAN_BOM` 56 | :data:`MS_ASYNC` 57 | :data:`MS_INVALIDATE` 58 | :data:`MS_SYNC` 59 | :data:`DL_LOAD_PATH` 60 | :data:`RTLD_DEEPBIND` 61 | :data:`RTLD_LOCAL` 62 | :data:`RTLD_NOLOAD` 63 | :data:`RTLD_LAZY` 64 | :data:`RTLD_NOW` 65 | :data:`RTLD_GLOBAL` 66 | :data:`RTLD_NODELETE` 67 | :data:`RTLD_FIRST` 68 | -------------------------------------------------------------------------------- /stdlib/index.rst: -------------------------------------------------------------------------------- 1 | .. _stdlib-index: 2 | 3 | ############################ 4 | The Julia Standard Library 5 | ############################ 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | base 11 | collections 12 | math 13 | numbers 14 | strings 15 | arrays 16 | parallel 17 | linalg 18 | constants 19 | file 20 | io-network 21 | punctuation 22 | sort 23 | pkg 24 | test 25 | c 26 | libc 27 | libdl 28 | profile 29 | -------------------------------------------------------------------------------- /stdlib/libc.rst: -------------------------------------------------------------------------------- 1 | .. module:: Libc 2 | 3 | ******************** 4 | C Standard Library 5 | ******************** 6 | 7 | .. function:: malloc(size::Integer) -> Ptr{Void} 8 | 9 | .. Docstring generated from Julia source 10 | 11 | Call ``malloc`` from the C standard library. 12 | 13 | .. function:: calloc(num::Integer, size::Integer) -> Ptr{Void} 14 | 15 | .. Docstring generated from Julia source 16 | 17 | Call ``calloc`` from the C standard library. 18 | 19 | .. function:: realloc(addr::Ptr, size::Integer) -> Ptr{Void} 20 | 21 | .. Docstring generated from Julia source 22 | 23 | Call ``realloc`` from the C standard library. 24 | 25 | See warning in the documentation for ``free`` regarding only using this on memory originally obtained from ``malloc``\ . 26 | 27 | .. function:: free(addr::Ptr) 28 | 29 | .. Docstring generated from Julia source 30 | 31 | Call ``free`` from the C standard library. Only use this on memory obtained from ``malloc``\ , not on pointers retrieved from other C libraries. ``Ptr`` objects obtained from C libraries should be freed by the free functions defined in that library, to avoid assertion failures if multiple ``libc`` libraries exist on the system. 32 | 33 | .. function:: errno([code]) 34 | 35 | .. Docstring generated from Julia source 36 | 37 | Get the value of the C library's ``errno``\ . If an argument is specified, it is used to set the value of ``errno``\ . 38 | 39 | The value of ``errno`` is only valid immediately after a ``ccall`` to a C library routine that sets it. Specifically, you cannot call ``errno`` at the next prompt in a REPL, because lots of code is executed between prompts. 40 | 41 | .. function:: strerror(n=errno()) 42 | 43 | .. Docstring generated from Julia source 44 | 45 | Convert a system call error code to a descriptive string 46 | 47 | .. function:: GetLastError() 48 | 49 | .. Docstring generated from Julia source 50 | 51 | Call the Win32 ``GetLastError`` function [only available on Windows]. 52 | 53 | .. function:: FormatMessage(n=GetLastError()) 54 | 55 | .. Docstring generated from Julia source 56 | 57 | Convert a Win32 system call error code to a descriptive string [only available on Windows]. 58 | 59 | .. function:: time(t::TmStruct) 60 | 61 | .. Docstring generated from Julia source 62 | 63 | Converts a ``TmStruct`` struct to a number of seconds since the epoch. 64 | 65 | .. function:: strftime([format], time) 66 | 67 | .. Docstring generated from Julia source 68 | 69 | Convert time, given as a number of seconds since the epoch or a ``TmStruct``\ , to a formatted string using the given format. Supported formats are the same as those in the standard C library. 70 | 71 | .. function:: strptime([format], timestr) 72 | 73 | .. Docstring generated from Julia source 74 | 75 | Parse a formatted time string into a ``TmStruct`` giving the seconds, minute, hour, date, etc. Supported formats are the same as those in the standard C library. On some platforms, timezones will not be parsed correctly. If the result of this function will be passed to ``time`` to convert it to seconds since the epoch, the ``isdst`` field should be filled in manually. Setting it to ``-1`` will tell the C library to use the current system settings to determine the timezone. 76 | 77 | .. function:: TmStruct([seconds]) 78 | 79 | .. Docstring generated from Julia source 80 | 81 | Convert a number of seconds since the epoch to broken-down format, with fields ``sec``\ , ``min``\ , ``hour``\ , ``mday``\ , ``month``\ , ``year``\ , ``wday``\ , ``yday``\ , and ``isdst``\ . 82 | 83 | .. function:: flush_cstdio() 84 | 85 | .. Docstring generated from Julia source 86 | 87 | Flushes the C ``stdout`` and ``stderr`` streams (which may have been written to by external C code). 88 | 89 | .. function:: msync(ptr, len, [flags]) 90 | 91 | .. Docstring generated from Julia source 92 | 93 | Forces synchronization of the :func:`mmap`\ ped memory region from ``ptr`` to ``ptr+len``. Flags defaults to ``MS_SYNC``, but can be a combination of ``MS_ASYNC``, ``MS_SYNC``, or ``MS_INVALIDATE``. See your platform man page for specifics. The flags argument is not valid on Windows. 94 | 95 | You may not need to call ``msync``, because synchronization is performed at intervals automatically by the operating system. However, you can call this directly if, for example, you are concerned about losing the result of a long-running calculation. 96 | 97 | .. data:: MS_ASYNC 98 | 99 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 100 | 101 | .. data:: MS_SYNC 102 | 103 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 104 | 105 | .. data:: MS_INVALIDATE 106 | 107 | Enum constant for :func:`msync`. See your platform man page for details. (not available on Windows). 108 | -------------------------------------------------------------------------------- /stdlib/libdl.rst: -------------------------------------------------------------------------------- 1 | .. module:: Libdl 2 | 3 | **************** 4 | Dynamic Linker 5 | **************** 6 | 7 | .. function:: dlopen(libfile::AbstractString [, flags::Integer]) 8 | 9 | .. Docstring generated from Julia source 10 | 11 | Load a shared library, returning an opaque handle. 12 | 13 | The optional flags argument is a bitwise-or of zero or more of ``RTLD_LOCAL``\ , ``RTLD_GLOBAL``\ , ``RTLD_LAZY``\ , ``RTLD_NOW``\ , ``RTLD_NODELETE``\ , ``RTLD_NOLOAD``\ , ``RTLD_DEEPBIND``\ , and ``RTLD_FIRST``\ . These are converted to the corresponding flags of the POSIX (and/or GNU libc and/or MacOS) dlopen command, if possible, or are ignored if the specified functionality is not available on the current platform. The default flags are platform specific. On MacOS the default ``dlopen`` flags are ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL`` while on other platforms the defaults are ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_LOCAL``\ . An important usage of these flags is to specify non default behavior for when the dynamic library loader binds library references to exported symbols and if the bound references are put into process local or global scope. For instance ``RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL`` allows the library's symbols to be available for usage in other shared libraries, addressing situations where there are dependencies between shared libraries. 14 | 15 | .. function:: dlopen_e(libfile::AbstractString [, flags::Integer]) 16 | 17 | .. Docstring generated from Julia source 18 | 19 | Similar to :func:`dlopen`, except returns a ``NULL`` pointer instead of raising errors. 20 | 21 | .. data:: RTLD_DEEPBIND 22 | 23 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 24 | 25 | .. data:: RTLD_FIRST 26 | 27 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 28 | 29 | .. data:: RTLD_GLOBAL 30 | 31 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 32 | 33 | .. data:: RTLD_LAZY 34 | 35 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 36 | 37 | .. data:: RTLD_LOCAL 38 | 39 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 40 | 41 | .. data:: RTLD_NODELETE 42 | 43 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 44 | 45 | .. data:: RTLD_NOLOAD 46 | 47 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 48 | 49 | .. data:: RTLD_NOW 50 | 51 | Enum constant for :func:`dlopen`. See your platform man page for details, if applicable. 52 | 53 | .. function:: dlsym(handle, sym) 54 | 55 | .. Docstring generated from Julia source 56 | 57 | Look up a symbol from a shared library handle, return callable function pointer on success. 58 | 59 | .. function:: dlsym_e(handle, sym) 60 | 61 | .. Docstring generated from Julia source 62 | 63 | Look up a symbol from a shared library handle, silently return ``NULL`` pointer on lookup failure. 64 | 65 | .. function:: dlclose(handle) 66 | 67 | .. Docstring generated from Julia source 68 | 69 | Close shared library referenced by handle. 70 | 71 | .. data:: dlext 72 | 73 | File extension for dynamic libraries (e.g. dll, dylib, so) on the current platform. 74 | 75 | .. function:: find_library(names, locations) 76 | 77 | .. Docstring generated from Julia source 78 | 79 | Searches for the first library in ``names`` in the paths in the ``locations`` list, ``DL_LOAD_PATH``\ , or system library paths (in that order) which can successfully be dlopen'd. On success, the return value will be one of the names (potentially prefixed by one of the paths in locations). This string can be assigned to a ``global const`` and used as the library name in future ``ccall``\ 's. On failure, it returns the empty string. 80 | 81 | .. data:: DL_LOAD_PATH 82 | 83 | When calling ``dlopen``, the paths in this list will be searched first, in order, before searching the 84 | system locations for a valid library handle. 85 | -------------------------------------------------------------------------------- /stdlib/profile.rst: -------------------------------------------------------------------------------- 1 | .. module:: Profile 2 | 3 | .. _stdlib-profiling: 4 | 5 | *********** 6 | Profiling 7 | *********** 8 | 9 | .. currentmodule:: Base 10 | 11 | .. function:: @profile 12 | 13 | .. Docstring generated from Julia source 14 | 15 | ``@profile `` runs your expression while taking periodic backtraces. These are appended to an internal buffer of backtraces. 16 | 17 | .. currentmodule:: Base.Profile 18 | 19 | The methods in :mod:`Base.Profile` are not exported and need to be called e.g. as ``Profile.print()``. 20 | 21 | .. function:: clear() 22 | 23 | .. Docstring generated from Julia source 24 | 25 | Clear any existing backtraces from the internal buffer. 26 | 27 | .. function:: print([io::IO = STDOUT,] [data::Vector]; format = :tree, C = false, combine = true, cols = tty_cols()) 28 | 29 | .. Docstring generated from Julia source 30 | 31 | Prints profiling results to ``io`` (by default, ``STDOUT``). If you 32 | do not supply a ``data`` vector, the internal buffer of accumulated 33 | backtraces will be used. ``format`` can be ``:tree`` or 34 | ``:flat``. If ``C==true``, backtraces from C and Fortran code are 35 | shown. ``combine==true`` merges instruction pointers that 36 | correspond to the same line of code. ``cols`` controls the width 37 | of the display. 38 | 39 | .. function:: print([io::IO = STDOUT,] data::Vector, lidict::Dict; format = :tree, combine = true, cols = tty_cols()) 40 | 41 | .. Docstring generated from Julia source 42 | 43 | Prints profiling results to ``io``. This variant is used to examine 44 | results exported by a previous call to :func:`retrieve`. 45 | Supply the vector ``data`` of backtraces and a dictionary 46 | ``lidict`` of line information. 47 | 48 | .. function:: init(; n::Integer, delay::Float64) 49 | 50 | .. Docstring generated from Julia source 51 | 52 | Configure the ``delay`` between backtraces (measured in seconds), and the number ``n`` of instruction pointers that may be stored. Each instruction pointer corresponds to a single line of code; backtraces generally consist of a long list of instruction pointers. Default settings can be obtained by calling this function with no arguments, and each can be set independently using keywords or in the order ``(n, delay)``\ . 53 | 54 | .. function:: fetch() -> data 55 | 56 | .. Docstring generated from Julia source 57 | 58 | Returns a reference to the internal buffer of backtraces. Note that 59 | subsequent operations, like :func:`clear`, can affect 60 | ``data`` unless you first make a copy. Note that the values in 61 | ``data`` have meaning only on this machine in the current session, 62 | because it depends on the exact memory addresses used in 63 | JIT-compiling. This function is primarily for internal use; 64 | :func:`retrieve` may be a better choice for most users. 65 | 66 | .. function:: retrieve() -> data, lidict 67 | 68 | .. Docstring generated from Julia source 69 | 70 | "Exports" profiling results in a portable format, returning the set of all backtraces (``data``\ ) and a dictionary that maps the (session-specific) instruction pointers in ``data`` to ``LineInfo`` values that store the file name, function name, and line number. This function allows you to save profiling results for future analysis. 71 | 72 | .. function:: callers(funcname, [data, lidict], [filename=], [linerange=]) -> Vector{Tuple{count, linfo}} 73 | 74 | .. Docstring generated from Julia source 75 | 76 | Given a previous profiling run, determine who called a particular 77 | function. Supplying the filename (and optionally, range of line 78 | numbers over which the function is defined) allows you to 79 | disambiguate an overloaded method. The returned value is a vector 80 | containing a count of the number of calls and line information 81 | about the caller. One can optionally supply backtrace data 82 | obtained from :func:`retrieve`; otherwise, the current internal profile 83 | buffer is used. 84 | 85 | .. function:: clear_malloc_data() 86 | 87 | .. Docstring generated from Julia source 88 | 89 | Clears any stored memory allocation data when running julia with 90 | ``--track-allocation``. Execute the command(s) you want to test 91 | (to force JIT-compilation), then call :func:`clear_malloc_data`. 92 | Then execute your command(s) again, quit Julia, and examine the 93 | resulting ``*.mem`` files. 94 | 95 | -------------------------------------------------------------------------------- /stdlib/punctuation.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Punctuation 3 | ************* 4 | 5 | Extended documentation for mathematical symbols & functions is :ref:`here `. 6 | 7 | ========= ================================================ 8 | symbol meaning 9 | ========= ================================================ 10 | ``@m`` invoke macro ``m``; followed by space-separated expressions 11 | ``!`` prefix "not" operator 12 | ``a!( )`` at the end of a function name, ``!`` indicates that a function modifies its argument(s) 13 | ``#`` begin single line comment 14 | ``#=`` begin multi-line comment (these are nestable) 15 | ``=#`` end multi-line comment 16 | ``$`` bitwise xor operator, string and expression interpolation 17 | ``%`` remainder operator 18 | ``^`` exponent operator 19 | ``&`` bitwise and 20 | ``&&`` short-circuiting boolean and 21 | ``|`` bitwise or 22 | ``||`` short-circuiting boolean or 23 | ``*`` multiply, or matrix multiply 24 | ``()`` the empty tuple 25 | ``~`` bitwise not operator 26 | ``\`` backslash operator 27 | ``'`` complex transpose operator A\ :sup:`H` 28 | ``a[]`` array indexing 29 | ``[,]`` vertical concatenation 30 | ``[;]`` also vertical concatenation 31 | ``[ ]`` with space-separated expressions, horizontal concatenation 32 | ``T{ }`` parametric type instantiation 33 | ``{ }`` construct a cell array (deprecated in 0.4 in favor of ``Any[]``) 34 | ``;`` statement separator 35 | ``,`` separate function arguments or tuple components 36 | ``?`` 3-argument conditional operator (conditional ? if_true : if_false) 37 | ``""`` delimit string literals 38 | ``''`` delimit character literals 39 | ``` ``` delimit external process (command) specifications 40 | ``...`` splice arguments into a function call or declare a varargs function or type 41 | ``.`` access named fields in objects or names inside modules, also prefixes elementwise operators 42 | ``a:b`` range a, a+1, a+2, ..., b 43 | ``a:s:b`` range a, a+s, a+2s, ..., b 44 | ``:`` index an entire dimension (1:end) 45 | ``::`` type annotation, depending on context 46 | ``:( )`` quoted expression 47 | ``:a`` symbol a 48 | ========= ================================================ 49 | -------------------------------------------------------------------------------- /stdlib/test.rst: -------------------------------------------------------------------------------- 1 | ***************************** 2 | Unit and Functional Testing 3 | ***************************** 4 | 5 | Testing Base Julia 6 | ------------------ 7 | 8 | Julia is under rapid development and has an extensive test suite to 9 | verify functionality across multiple platforms. If you build Julia 10 | from source, you can run this test suite with ``make test``. In a 11 | binary install, you can run the test suite using ``Base.runtests()``. 12 | 13 | .. currentmodule:: Base 14 | 15 | .. function:: runtests([tests=["all"] [, numcores=iceil(CPU_CORES/2) ]]) 16 | 17 | .. Docstring generated from Julia source 18 | 19 | Run the Julia unit tests listed in ``tests``\ , which can be either a string or an array of strings, using ``numcores`` processors. (not exported) 20 | 21 | .. module:: Base.Test 22 | 23 | Test Framework 24 | -------------- 25 | 26 | The ``Test`` module contains macros and functions related to testing. 27 | A default handler is provided to run the tests, and a custom one can be 28 | provided by the user by using the :func:`registerhandler` function. 29 | 30 | To use the default handler, the macro :func:`@test` can be used directly:: 31 | 32 | julia> using Base.Test 33 | 34 | julia> @test 1 == 1 35 | 36 | julia> @test 1 == 0 37 | ERROR: test failed: 1 == 0 38 | in error at error.jl:21 39 | in default_handler at test.jl:19 40 | in do_test at test.jl:39 41 | 42 | julia> @test error("This is what happens when a test fails") 43 | ERROR: test error during error("This is what happens when a test fails") 44 | This is what happens when a test fails 45 | in error at error.jl:21 46 | in anonymous at test.jl:62 47 | in do_test at test.jl:37 48 | 49 | As seen in the examples above, failures or errors will print the abstract 50 | syntax tree of the expression in question. 51 | 52 | Another macro is provided to check if the given expression throws an exception of type ``extype``, 53 | :func:`@test_throws`:: 54 | 55 | julia> @test_throws ErrorException error("An error") 56 | ErrorException("An error") 57 | 58 | julia> @test_throws BoundsError error("An error") 59 | ERROR: test failed: error("An error") 60 | in error at error.jl:21 61 | in default_handler at test.jl:19 62 | in do_test_throws at test.jl:55 63 | 64 | julia> @test_throws DomainError throw(DomainError()) 65 | DomainError() 66 | 67 | julia> @test_throws DomainError throw(EOFError()) 68 | ERROR: test failed: throw(EOFError()) 69 | in error at error.jl:21 70 | in default_handler at test.jl:19 71 | in do_test_throws at test.jl:55 72 | 73 | 74 | As floating-point values can be imprecise, you can perform approximate 75 | equality checks using either ``@test a ≈ b`` (where ``≈``, typed via 76 | tab completion of ``\approx``, is the ``isapprox`` function) or use 77 | the macros ``@test_approx_eq`` macro (which differs from ``isapprox`` 78 | in that it treats NaN values as equal and has a smaller default 79 | tolerance) or ``@test_approx_eq_eps`` (which takes an extra argument 80 | indicating the relative tolerance):: 81 | 82 | julia> @test 1 ≈ 0.999999999 83 | 84 | julia> @test 1 ≈ 0.999999 85 | ERROR: test failed: 1 isapprox 0.999999 86 | in expression: 1 ≈ 0.999999 87 | in error at error.jl:21 88 | in default_handler at test.jl:30 89 | in do_test at test.jl:53 90 | 91 | julia> @test_approx_eq 1. 0.999999999 92 | ERROR: assertion failed: |1.0 - 0.999999999| < 2.220446049250313e-12 93 | 1.0 = 1.0 94 | 0.999999999 = 0.999999999 95 | in test_approx_eq at test.jl:75 96 | in test_approx_eq at test.jl:80 97 | 98 | julia> @test_approx_eq 1. 0.9999999999999 99 | 100 | julia> @test_approx_eq_eps 1. 0.999 1e-2 101 | 102 | julia> @test_approx_eq_eps 1. 0.999 1e-3 103 | ERROR: assertion failed: |1.0 - 0.999| <= 0.001 104 | 1.0 = 1.0 105 | 0.999 = 0.999 106 | difference = 0.0010000000000000009 > 0.001 107 | in error at error.jl:22 108 | in test_approx_eq at test.jl:68 109 | 110 | Handlers 111 | -------- 112 | 113 | A handler is a function defined for three kinds of arguments: ``Success``, ``Failure``, ``Error``:: 114 | 115 | # An example definition of a test handler 116 | test_handler(r::Success) = nothing 117 | test_handler(r::Failure) = error("test failed: $(r.expr)") 118 | test_handler(r::Error) = rethrow(r) 119 | 120 | A different handler can be used for a block (with :func:`with_handler`):: 121 | 122 | julia> using Base.Test 123 | 124 | julia> custom_handler(r::Test.Success) = println("Success on $(r.expr)") 125 | custom_handler (generic function with 1 method) 126 | 127 | julia> custom_handler(r::Test.Failure) = error("Error on custom handler: $(r.expr)") 128 | custom_handler (generic function with 2 methods) 129 | 130 | julia> custom_handler(r::Test.Error) = rethrow(r) 131 | custom_handler (generic function with 3 methods) 132 | 133 | julia> Test.with_handler(custom_handler) do 134 | @test 1 == 1 135 | @test 1 != 1 136 | end 137 | Success on :((1==1)) 138 | ERROR: Error on custom handler: :((1!=1)) 139 | in error at error.jl:21 140 | in custom_handler at none:1 141 | in do_test at test.jl:39 142 | in anonymous at no file:3 143 | in task_local_storage at task.jl:28 144 | in with_handler at test.jl:24 145 | 146 | The ``Success`` and ``Failure`` types include an additonal field, ``resultexpr``, which is a partially evaluated expression. For example, in a comparison it will contain an expression with the left and right sides evaluated. 147 | 148 | Macros 149 | ------ 150 | 151 | .. function:: @test(ex) 152 | 153 | .. Docstring generated from Julia source 154 | 155 | Test the expression ``ex`` and calls the current handler to handle the result. 156 | 157 | .. function:: @test_throws(extype, ex) 158 | 159 | .. Docstring generated from Julia source 160 | 161 | Test that the expression ``ex`` throws an exception of type ``extype`` and calls the current handler to handle the result. 162 | 163 | .. function:: @test_approx_eq(a, b) 164 | 165 | .. Docstring generated from Julia source 166 | 167 | Test two floating point numbers ``a`` and ``b`` for equality taking in account small numerical errors. 168 | 169 | .. function:: @test_approx_eq_eps(a, b, tol) 170 | 171 | .. Docstring generated from Julia source 172 | 173 | Test two floating point numbers ``a`` and ``b`` for equality taking in account a margin of tolerance given by ``tol``\ . 174 | 175 | Functions 176 | --------- 177 | 178 | .. function:: with_handler(f, handler) 179 | 180 | .. Docstring generated from Julia source 181 | 182 | Run the function ``f`` using the ``handler`` as the handler. 183 | 184 | --------------------------------------------------------------------------------