์ด ๋ฌธ์ ๋ https://github.com/Bioconductor/BiocParallel/issues/67 ๋ก ์ด์ด์ง๋ ๊ฒ ๊ฐ์ต๋๋ค.
library(parallel)
library(data.table)
mclapply(1:2, sqrt)
์ ์ด์ธ๋ฆฌ๋ค
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] data.table_1.10.4-2
loaded via a namespace (and not attached):
[1] compiler_3.4.2
์ ๊ณ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
1.10.4-1์ ๋ํ NEWS์ ํญ๋ชฉ 4:
data.table ์ดํ ํจํค์ง '๋ณ๋ ฌ' ํฌํฌ๊ฐ OpenMP์ ๋ณ๋ ฌ๋ก ์ํ๋ ๋ Intel์ OpenMP๋ฅผ ์ฌ์ฉํ์ฌ Mac์์ ๊ฐ์ ์ ์๋ํ์ต๋๋ค. ํด๋น OpenMP ๊ตฌํ์ ๋ณ๋ ฌ ์์ญ์ด ์๋ฃ๋ ํ ์ค๋ ๋๋ฅผ ๊ณ์ ์คํํ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. ์ด ์์ ์ฌํญ์ด ์ฌ์ ํ ์๋ํ์ง ์์ผ๋ฉด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ์ผ๋ก ๋ณด๊ณ ๋ library(data.table) ์งํ์ setDTthreads(1)๋ฅผ ํธ์ถํ์ญ์์ค.
dev์์ ๋์ผํ ํญ๋ชฉ์ ๊ฐ์ ํ์ง๋ง ๋ด์ค ํญ๋ชฉ์ด CRAN ํจ์น๋ก ๋ณ๊ฒฝ๋๋ค๋ ๋ฐฑํฌํธ๋ฅผ ๋ฌด์ํ์ต๋๋ค. ๊ฐ๋ฐ์ ๋ด์ค ํ์ผ ์์:
๋ณ๋ ฌ ํจํค์ง๋ ์ฌ์ฉํ ๋ Mac ์ ์ฉ ๊ฐ์ ์๋(ํฌํฌ), #2137. Intel์ OpenMP ๊ตฌํ์ GNU libgomp์ ๋ฌ๋ฆฌ OpenMP ๋ณ๋ ฌ ์์ญ(data.table ๋ด๋ถ)์ด ์๋ฃ๋ ํ ์ค๋ ๋๋ฅผ ๊ณ์ ์คํํ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. ๋ฐ๋ผ์ data.table์ด ์ด๋ฏธ ๋ณ๋ ฌ๋ก ์คํ๋ ํ ์ฌ์ฉ์๊ฐ ๋ณ๋ ฌ์ ํฌํฌ๋ฅผ ํธ์ถํ๋ฉด ๋ถ์์ ์ด ๋ฐ์ํฉ๋๋ค. ๋ฌธ์ ๋ Intel์ OpenMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ CRAN์ ์ํด โโ๊ตฌ์ถ๋์๊ธฐ ๋๋ฌธ์ CRAN์ Mac ํจํค์ง ๋ฐ์ด๋๋ฆฌ์์๋ง ๋ฐ์ํฉ๋๋ค. Windows ๋๋ Linux์์ ์๋ ค์ง ๋ฌธ์ ๊ฐ ์์ผ๋ฉฐ ๋ณ๋ ฌ์ด ์ฌ์ฉ๋์ง ์์ ๋ ๋ชจ๋ ํ๋ซํผ์์ ์๋ ค์ง ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์ด Mac ์ ์ฉ ์์ ํ๋ก๊ทธ๋จ์ด ์ฌ์ ํ ์๋ํ์ง ์์ผ๋ฉด ์ด์ ์ data.table์ ๋จ์ผ ์ค๋ ๋ ๋ชจ๋๋ก ์ค์ ํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ์ผ๋ก ๋ณด๊ณ ๋ library(data.table) ์งํ์ setDTthreads(1)๋ฅผ ํธ์ถํ์ญ์์ค.
๊ทธ๋ฌ๋ ๊ทํ์ ๊ฒฝ์ฐ ํฌํฌํ๊ธฐ ์ ์ data.table์ ์ฌ์ฉํ์ง๋ ์์์ต๋๋ค. ๊ทธ๋์ ๊ทธ๊ฒ์ ์ด์ ์ ๋ณด๊ณ ๋ ์ ์ด ์๋ ์๋ก์ด ์ธก๋ฉด์
๋๋ค. ๊ทธ 3์ค์ด ๋ง ๊ทธ๋๋ก ์๋ก์ด R ์ธ์
์์ ๋ฐ์ํ๋ ๋ชจ๋ ๊ฒ์ด๋ผ๋ ์ ์์ ์ฌํ ๊ฐ๋ฅํ ์๊ฐ ์๊ฒฉํ ์ ํํฉ๋๊น? ์ฆ, ๋ก๋์ mclapply
ํธ์ถ ์ฌ์ด์ data.table์ ์ฌ์ฉํ์ง ์์ต๋๊น? ์ด์จ๋ library(data.table)
setDTthreads(1)
์ ํธ์ถํ ์ ์์ง๋ง mclapply
์ ์ data.table ์ ์ค์ ๋ก ์ฌ์ฉํ์ง ์์ผ๋ฉด ๋์์ด ๋ ์ง ์์ฌ๋ฉ๋๋ค.
CRAN mac ๋ฐ์ด๋๋ฆฌ๋ฅผ ์ค์นํ์ต๋๊น, ์๋๋ฉด ์์ค์์ ์ค์นํ์ต๋๊น? OpenMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ์ด mclapply
๋ฌธ์ ์ ๊ด๋ จํ์ฌ MacOS์์ ์ค์ํ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ์ปดํจํฐ์์ ์ฌ์ฉ ์ค์ธ ๊ฒ์ด Intel(libomp) ๋๋ GNU(libgomp) OpenMP ๊ตฌํ์ธ์ง ํ์ธํ ์ ์์ต๋๊น?
MacOS ์ง์นจ ์ ์ฌ์ฉํ์ฌ ์์ค์์ ์ปดํ์ผํ ์ ์์ผ๋ฉฐ ๋์์ด ๋ฉ๋๊น? ์ ์ ํ OpenMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ํ ๋ก์ปฌ ๋งํฌ ๋๋ ์ด์ ์ ์ฌํ ๊ฒ์ผ ์ ์์ต๋๋ค. ์ผ๋ถ ์ฌ๋๋ค์ ์ง์นจ์ ์ ํํ๊ฒ ๋ฐ๋ฅด์ง ์์๊ธฐ ๋๋ฌธ์ MacOS์์ ์ ํํ๊ฒ ๋ฐ๋ผ์ผ ํฉ๋๋ค.
test.data.table()
์ด(๊ฐ) ํจ๊ณผ๊ฐ ์์ต๋๊น? ํ
์คํธ 1705๋ mclapply
๋ฅผ ํ
์คํธํ๊ณ CRAN์ ํต๊ณผํฉ๋๋ค. CRAN์ด MacOS์์ Mac ๋ฐ์ด๋๋ฆฌ๋ฅผ ํ
์คํธํ๋ค๊ณ ๊ฐ์ ํ์ง๋ง ๋ค๋ฅธ ๋น๋๋ฅผ ํ
์คํธํ๋ค๊ณ ๊ฐ์ ํ ์๋ ์์ต๋๋ค.
1.10.4-2์ NEWS ํญ๋ชฉ 1์ ๊ด๋ จ์ด ์๋์ง ์์ฌ๋์ง๋ง ์์ ์ฑ์ ์ํด ์ธ๊ธํ๊ฒ ์ต๋๋ค.
MacOS์ OpenMP๋ ์ด์ CRAN์์ ์ง์๋๋ฉฐ Mac์ฉ CRAN ํจํค์ง ๋ฐ์ด๋๋ฆฌ์ ํฌํจ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ์ปดํ์ผ ํ์ #2409์์ OpenMP๊ฐ ํ์ฑํ๋์ง ์์์ ๋ MacOS์ ์์ค์์ v1.10.4-1์ ์ค์นํ๋ ๋ฐ ์คํจํ์ต๋๋ค. ๋ณด๊ณ ํด ์ฃผ์ Liz Macfie์ @fupangpangpang ์๊ฒ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. OpenMP๊ฐ ํ์ฑํ๋์ง ์์์ ๋ ์์ ๋ฉ์์ง๊ฐ ์ ๋ฐ์ดํธ๋์์ต๋๋ค.
๊ด๋ จ ๋ฌธ์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
https://github.com/Rdatatable/data.table/issues/2413
https://github.com/Rdatatable/data.table/issues/2409
https://github.com/Rdatatable/data.table/issues/2406
https://github.com/Rdatatable/data.table/issues/2137
์ ๋ ๊ธฐ๋ณธ์ ์ผ๋ก MacOS๋ก ์ด๋ ค์์ ๊ฒช๊ณ ์์ต๋๋ค. Apple ๋ฐ/๋๋ Intel์ ์ ํ์ ์ง์ํ ์ ์๋ ์ฌ๋์ด ์๋ค๋ฉด ์ ๋ง ์ข์ ๊ฒ์ ๋๋ค. ๋๋ ๊ทธ๊ฒ์ด ์ด๋ป๊ฒ data.table ๋ฌธ์ ์ธ์ง ํ์ธํ๊ธฐ ์ํด ๊ณ ๊ตฐ๋ถํฌํฉ๋๋ค. ๋๋ ๊ทธ๊ฒ์ ํด๊ฒฐํ๊ณ ๊ทธ๊ฒ์ NEWS์ ๋ฌธ์ํํ ์ ์๋ค๊ณ ์๊ฐํ ์ ์๋ ๋ชจ๋ ๊ฒ์ ์๋ํ์ต๋๋ค. ๋์๊ณผ ์ ์์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
์, ๋ง ์๋ ๊ฐ๋จํ ์คํฌ๋ฆฝํธ
library(parallel)
library(data.table)
mclapply(1:2, sqrt)
์ด๊ฒ์ Bioconductor ๋น๋ ๋จธ์ ์ ์์ต๋๋ค. ๋๋ ์ด๊ฒ์ด ๊ฐ๋จํ ๋ฐ์ด๋๋ฆฌ ์ค์น๋ผ๊ณ ์๊ฐํ์ง๋ง ํ์ธํ๊ฒ ์ต๋๋ค. ์ฐ๋ฆฌ๋
$ ls /Library/Frameworks/R.framework/Resources/lib
libR.dylib libRlapack.dylib.dSYM libquadmath.0.dylib
libR.dylib.dSYM libc++.1.dylib libreadline.5.2.dylib
libRblas.0.dylib libc++abi.1.dylib libreadline.dylib
libRblas.dylib libgcc_s.1.dylib libunwind.1.dylib
libRblas.dylib.dSYM libgfortran.3.dylib
libRlapack.dylib libomp.dylib
๊ทธ๋ฆฌ๊ณ
$ otool -L /Library/Frameworks/R.framework/Resources/bin/exec/R
/Library/Frameworks/R.framework/Resources/bin/exec/R:
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libR.dylib (compatibility version 3.4.0, current version 3.4.2)
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libomp.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
๋ฐ๋ผ์ ์๋ง๋ libomp์ ์ฐ๊ฒฐ๋ ๊ฒ์ ๋๋ค.
test.data.table()
๋ผ๊ณ
Running test id 1705 Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null.
Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
Running test id 1750 Test 1751 not run. If required call library(nanotime) first.
endian==little, sizeof(long double)==16, sizeof(pointer)==8
All 5936 tests in inst/tests/tests.Rraw completed ok in 00:01:45 on Sat Oct 14 21:25:30 2017
๊ฐ์ฌํฉ๋๋ค. ์, ์ด๋ฌํ __kmp_*
ํธ์ถ์ Intel OpenMP ๋ฐํ์์๋ง ํด๋น๋๋ฉฐ ์ด์ ์ ๋ณด๊ณ ๋ ๊ฒ์ ๋ณธ ์ ์ด ์์ต๋๋ค. ํ
์คํธ 1705๋ ํนํ ๊ทธ๊ฒ์ ํ
์คํธํ๊ณ ์์ต๋๋ค. data.table ์์ฒด ๋ด์์ 2๊ฐ์ OpenMP ์ค๋ ๋๋ฅผ ์ฌ์ฉํ๊ณ parallel::mclapply
๋ฅผ ํธ์ถํฉ๋๋ค. __kmp_
์ค๋ฅ๋ iiuc, Intel์ ๊ตฌํ์ด ๋ชจ๋ ๋ณ๋ ฌ ์์ญ์ด ์๋ฃ๋ ํ์๋ ์ค๋ ๋๋ฅผ ๊ณ์ ์คํํ๋๋ก ๋๋๊ธฐ ๋๋ฌธ์ ํ์ ํฌํฌ๊ฐ ๋ถ์์ ํ๊ธฐ ๋๋ฌธ์
๋๋ค. ์ด ๊ฒฝ์ฐ ์ถฉ๋ํ์ง ์์ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง ๊ทธ๊ฒ์ ๋จ์ง ์ด์
๋๋ค. 1.10.4-2์์ ํด๋น ์ถ๋ ฅ์ ๋ณด๊ณ ์๋ค๋ ์ฌ์ค์ ๋ด๊ฐ ์๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์๋ํ์ง ์์์์ ์๋ฏธํฉ๋๋ค. Intel ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋ถ๊ธฐ ์ ์ ์คํ ์ค์ธ ์ค๋ ๋๋ฅผ ์ ๋ฆฌํ ์ ์๊ธฐ๋ฅผ ๋ฐ๋ผ๋ฉฐ ์ด์ omp_set_num_threads(1)
๋ฅผ ํธ์ถํ๋ ์ฌ์ ๋ถ๊ธฐ ์ฝ๋ฐฑ์ด ์์ต๋๋ค. ํ์ง๋ง ๊ทธ๋ ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฐ๋ผ์ ์๋ํ๋ ๊ฒ์ผ๋ก ๋ณด๊ณ ๋ ๋ด์ฉ์ด ๋จ์ ์์ต๋๋ค. ์ฆ, library(data.table)
setDTthreads(1)
๋ฅผ ํธ์ถํ์ฌ Intel์ OpenMP๊ฐ ์ค๋ ๋๋ฅผ ์์ฑํ์ง ๋ชปํ๋๋ก ๋ง๋ ๊ฒ์
๋๋ค.
๋จ 3์ค๋ก ์ค๋จํ๋ฉด Intel์ OpenMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฐ๊ฒฐ๋๊ฑฐ๋ ์ด๊ธฐํ๋ ๋ ์ค๋ ๋๋ฅผ ์์ฑํ ์ ์์ต๋๊น? ๊ทธ๋ ๋ค๋ฉด ๊ทธ๊ฒ์ ์ค๋ช ํ ์ ์์ ๊ฒ์ ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ๋๋ ๊ทธ๊ฒ์ ๋ํด ์์ค์ ์ ์ต๋๋ค.
๋ํ clang
๋ฐ gcc
์ OpenMP ๊ธฐ๋ฅ์ด $ libomp
, libiomp
๋ฐ libgomp
์ 3๊ฐ์ง OpenMP ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ด๋ป๊ฒ ๊ด๋ จ๋๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. libomp
๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ๋ฌ๋ CRAN์ libiomp
๋ก ์ปดํ์ผ๋ฉ๋๊น? ์๋ง๋ ๊ทธ๊ฒ๊ณผ ๊ด๋ จ์ด ์์ต๋๋ค. ๋ํ ํ ์ฌ๋์ "llvm์ gcc๋ก ๋ณ๊ฒฝ"์ด MacOS์์ ์ถฉ๋์ ์ค์งํ์ง๋ง ์์ค์์ ์ปดํ์ผํ๋ค๊ณ ๋ณด๊ณ ํ์ต๋๋ค( here ).
๋ฐฉ๊ธ Intel OpenMP ๋ฐํ์์ ์์ค ์ฝ๋๋ฅผ ๋ฐ๊ฒฌํ์ต๋๋ค. ์ธํ ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋น๊ณต๊ฐ ์์ค๋ผ๊ณ ์๊ฐํ๊ธฐ ๋๋ฌธ์ ์ด ํ๋ก์ ํธ๊ฐ ๋ฌด์์ธ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๊ฒ์ ๋ํด ์ปดํ์ผํ๊ณ ๋๋ฒ๊ทธํ๋ ๊ฒ์ด ๊ฐ๋ฅํ ์๋ ์์ต๋๋ค. https://www.openmprtl.org/ ๋จผ์ ๋ก์ปฌ์์ ์ปดํ์ผํ๊ณ ์๋ํ๋์ง ํ์ธํ๊ฑฐ๋ GNU ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๋ ์ฌ์ธ ๊ฒ์ ๋๋ค.
ํ
์คํธ 1705๋ CRAN์ ํต๊ณผํ๊ณ ์์ผ๋ฏ๋ก CRAN ๊ธฐ๊ณ์ ๊ทํ์ ๊ธฐ๊ณ ์ฌ์ด์ ์ฐจ์ด์ ์ ์์๋ด์ ์๋ง๋ ํฌ๋ง์ ์ผ ๊ฒ์
๋๋ค. ํ
์คํธ 1705๋ ์ค์ ๋ก ๋น์ ๊ณผ CRAN์ ๋ํด ํต๊ณผํ๊ณ ์์ง๋ง libomp
์ ํ
์คํธ์์ ์ ํํ์ง ๋ชปํ๋ ์ด์ค์
์ค๋ฅ๋ฅผ ์ฝ์์ ์ถ๋ ฅํ๊ณ ์์ต๋๋ค. __kmp
๋ฉ์์ง๊ฐ CRAN ๋ก๊ทธ์๋ ์๋์ง ํ์ธํ๊ธฐ ์ํด CRAN ๋ก๊ทธ๋ฅผ ๋ณผ ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค. ๋ฉ์์ง๊ฐ CRAN์ ๋ก๊ทธ์ ์์ผ๋ฉด CRAN ์์คํ
๊ณผ ์ฌ์ฉ์ ์์คํ
์ ์ฐจ์ด์ ์ ์ดํด๋ณด๋ ๊ฒ์ด ์ข์ต๋๋ค.
์๋ง๋ ์ด๊ฒ์ CRAN ํจํค์ง ๋ฐ์ด๋๋ฆฌ์ ํ์ํ ๊ฒ์
๋๋ค: http://macappstore.org/libiomp/
์๋๋ฉด libiomp๊ฐ CRAN์ ์ํด โโํจํค์ง ๋ฐ์ด๋๋ฆฌ๋ก ์ ์ ์ผ๋ก ์ปดํ์ผ๋ฉ๋๊น? ?install.packages
์ 'Binary packages' ์น์
์ MacOS์์ ์๋นํ ๋ณต์กํ๊ณ type=
์ธ์์ ๋ํ ์ฌ๋ฌ ๋ฐ์ด๋๋ฆฌ ์ต์
์ด ์๋ค๋ ๊ฒ์ ์์์ต๋๋ค.
์ธํ ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ธ์ ์ค์ ๋๋ค.
OMP: ์ค๋ฅ #13: kmp_runtime.cpp(6480)์์ ์ด์ค์ ์คํจ
OMP: ํํธ: ์ด ๋ฉ์์ง์ ํจ๊ป ๋ฒ๊ทธ ๋ณด๊ณ ์๋ฅผ ์ ์ถํ๊ณ , ์ฌ์ฉ๋ ๋ช ๋ น์ ์ปดํ์ผ ๋ฐ ์คํํ๊ณ , ๊ธฐ๋ณธ ์ปดํ์ผ๋ฌ ๋ฐ ์ด์ ์ฒด์ ๋ฒ์ ์ ํฌํจํ ์์คํ ๊ตฌ์ฑ ์ ๋ณด๋ฅผ ์ ์ถํ์ญ์์ค. ๋ชจ๋ ํ๋ก๊ทธ๋จ ์์ค๋ฅผ ํฌํจํ๋ฉด ๋ ๋น ๋ฅธ ์๋ต์ ์ป์ ์ ์์ต๋๋ค. ์ด ๋ฌธ์ ์ ์ถ์ ๋ํ ์ ๋ณด๋ http://www.intel.com/software/products/support/๋ฅผ ์ฐธ์กฐํ์ญ์์ค.
MacOS์ ๋ฌธ์ ๊ฐ ์๋ ์ฌ๋์ด Intel์ ๋ฌธ์ ๋ฅผ ์ ๊ธฐํ ์ ์์ต๋๊น?
์๋ ํ์ธ์, ์ ๋ ์๋ ํด๋น ํจํค์ง์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๋ ๋์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ BiocParallel ๋ฆฌํฌ์งํ ๋ฆฌ์ ๋ฌธ์ ๋ฅผ ๋ณด๊ณ ํ์ต๋๋ค. ๊ทธ๋ค์ data.table์ด ๋ก๋๋๋ ๋์ ํธ์ถ๋๋ mclapply๋ก ๋ฌธ์ ๋ฅผ ์ขํ์ต๋๋ค.
์ฌ๊ธฐ ์ ์ง์นจ์ ๋ฐ๋ผ MacOS์ ์ต์ ๋ฒ์ ์ data.table์ ์ค์นํ์ง๋ง ์ฌ์ ํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ํฅ๋ฏธ๋กญ๊ฒ๋ ๋๋ฃ๋ ์์ ์ Mac์ ์ต์ ๋ฒ์ ์ data.table์ ์ค์นํ๋๋ฐ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๋ ์์ ์ ์์คํ ์ OpenMP๋ฅผ ์ค์นํ์ง ์์์ต๋๋ค.
data.table 1.10.2๋ก ๋กค๋ฐฑํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค.
@asenabouth ์ธํ
์ ์ง์ ์์ฒญ์ ์ ๊ธฐํ ์ ์์ต๋๊น(์์ ์ ์๊ฒฌ ์ฐธ์กฐ)? ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋๋ Apple์ ๋๊ตฐ๊ฐ๊ฐ ๋์์ ์ค ์ ์์ต๋๋ค. ๊ทธ๋ค์ ์ง์์ ์ ํ ๋ฐ์ ์ ์์ต๋๊น? ์์ค์์ ์ค์นํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์๋๋ค๋ ํ์ ์ด ์์ต๋๋ค. ๋ช
๋ น๊ณผ ์ถ๋ ฅ์ ๋ณด์ฌ์ค ์ ์์ต๋๊น? ์์ค์์ ์ปดํ์ผํ๊ณ CRAN ๋ฐ์ด๋๋ฆฌ๋ฅผ ํผํ ํ์๋ data.table 1.10.4๊ฐ ๋ก๋๋ ํ์ ๋ค๋ฅธ ์ฌ๋์ด parallel::mclapply
๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๊น?
์ธํ ์ ์ง์ ์์ฒญ์ ์ ์ถํ๊ฒ ์ต๋๋ค.
์์ค์์ ์ค์นํ๋ ๊ฒฝ์ฐ ์ค์น ๋ฐ ํ์ ํ
์คํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
```{r}
[์ด์ ์ ์ ์ฅํ ์์
๊ณต๊ฐ ๋ณต์]
remove.packages("data.table")
'/Users/a.senabouth/Library/R/3.4/library'์์ ํจํค์ง ์ ๊ฑฐ
('lib'๊ฐ ์ง์ ๋์ง ์์๊ธฐ ๋๋ฌธ์)
install.packages("data.table", ์ ํ = "์์ค",
- repos = "http://Rdatatable.github.io/data.table")
'/Users/a.senabouth/Library/R/3.4/library'์ ํจํค์ง ์ค์น
('lib'๊ฐ ์ง์ ๋์ง ์์๊ธฐ ๋๋ฌธ์)
URL ' http://Rdatatable.github.io/data.table/src/contrib/data.table_1.10.5.tar.gz ' ์๋ ์ค์ฝํ ์ธ ์ ํ 'application/gzip' ๊ธธ์ด 3312731๋ฐ์ดํธ(3.2MB)
๋ค์ด๋ก๋ 3.2MB
uname -s
= '๋ค์' ]; ํ์ด/Users/a.senabouth/Library/R/3.4/library/data.table/libs์ ์ค์น* ๋ฅด๋ค์ด๋ก๋ํ ์์ค ํจํค์ง๋
'/๊ฐ์ธ/var/folders/zz/zyxvpxvq6csfxvn_n0001lp0000cxh/T/Rtmpl7TqS4/downloaded_packages'
์๋ฅด ์ํ
์ค๋ฅ: ๊ฐ์ฒด 'R'์ ์ฐพ์ ์ ์์ต๋๋ค.
๋ผ์ด๋ธ๋ฌ๋ฆฌ(๋ณ๋ ฌ)
๋ผ์ด๋ธ๋ฌ๋ฆฌ(data.table)
data.table 1.10.5 IN DEVELOPMENT ๊ตฌ์ถ 2017-10-16 07:29:07 UTC; ํธ๋๋น์ค
๊ฐ์ฅ ๋น ๋ฅธ ํ์ต ๋ฐฉ๋ฒ(data.table ์์ฑ์ ๊ธฐ์ค): https://www.datacamp.com/courses/data-analysis-the-data-table-way
๋ฌธ์: ?data.table, example(data.table) ๋ฐ browseVignettes("data.table")
๋ฆด๋ฆฌ์ค ์ ๋ณด, ๋น๋์ค ๋ฐ ์ฌ๋ผ์ด๋: http://r-datatable.com
mclapply(1:2, ์ ๊ณฑ๋ฏธํฐ)
* ๋ถ๋ฒ ์กฐ์ ์ ๋ฐ *
์ฃผ์ 0x7fffa9730ae4, '๋ถ๋ฒ opcode' ๋ฐ์
์ญ ์ถ์ :
1: ๋งฅํฌํฌ()
2: ํ(X[[i]], ...)
3: lapply(seq_len(์ฝ์ด), inner.do)
4: mclapply(1:2, ์ ๊ณฑ๋ฏธํฐ)
๊ฐ๋ฅํ ์กฐ์น:
1: ์ค๋จ(ํ์ฑํ๋ ๊ฒฝ์ฐ ์ฝ์ด ๋คํ ์ฌ์ฉ)
2: ์ผ๋ฐ R ์ข
๋ฃ
3: ์์
๊ณต๊ฐ์ ์ ์ฅํ์ง ์๊ณ R ์ข
๋ฃ
4: R ์ ์ฅ ์์
๊ณต๊ฐ ์ข
๋ฃ
And here's the session info:
```{r}
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] data.table_1.10.5
loaded via a namespace (and not attached):
[1] compiler_3.4.2
ํธ์ง :
์์ค์์ 1.10.4๋ฅผ ์ค์นํ์ฌ ์๋ํ๋๋ก ํ์ต๋๋ค.
```{r}
ํ์(devtools)
ํ์ํ ํจํค์ง ๋ก๋: devtools
install_version("data.table", ๋ฒ์ = "1.10.4", repos = "http://cran.us.r-project.org")
URL์์ ํจํค์ง ๋ค์ด๋ก๋: http://cran.us.r-project.org/src/contrib/Archive/data.table/data.table_1.10.4.tar.gz
data.table ์ค์น
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ
--no-save --no-restore --quiet CMD ์ค์น
'/๊ฐ์ธ/var/folders/zz/zyxvpxvq6csfxvn_n0001lp0000cxh/T/RtmpXDSgR8/devtoolsdf05280c79d9/data.table'
--library='/Users/a.senabouth/Library/R/3.4/library' --install-tests
uname -s
= '๋ค์' ]; ๊ทธ๋ฐ ๋ค์ install_name_tool -id datatable.so datatable.so; ํ์ด[[2]]
[1] 1.414214
```
๋ค์์ ๊ฒ์ํ์ต๋๋ค. https://software.intel.com/en-us/forums/intel-c-compiler/topic/746943
๊ทธ๊ฒ์ ์๋ง๋ ์๋ชป๋ ์์น์ ์์ ๊ฒ์ด๊ณ ๋๋ ์๋ง ๋ถ๊ธธ์ ํฉ์ธ์ผ ๊ฒ์ด์ง๋ง ๋ฐ๋ผ๊ฑด๋ ๊ทธ๊ฒ์ ๊ณต์ ๊ตด๋ฆด ๊ฒ์ ๋๋ค.
@mattdowle ๋ด๊ฐ ์ถ๊ฐํ๊ฑฐ๋ ํ๊ณ ์ถ์ ์ผ์ด ์์ผ๋ฉด ์๋ ค์ฃผ์ญ์์ค.
@asenabouth ์ ๋์ผํ ์ค๋ฅ๋ฅผ ์ฌํํ์ผ๋ฉฐ ์์ค์์ 1.10.4๋ฅผ ๋ค์ ์ค์นํ์ฌ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์๋์ง ํ์ธํ๊ณ ์ถ์์ต๋๋ค.
์ธ์ ์ ๋ณด:
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets base
other attached packages:
[1] data.table_1.10.4
loaded via a namespace (and not attached):
[1] compiler_3.4.2 methods_3.4.2
๋ด ์ปดํจํฐ์ ๋ช ๊ฐ์ง ์ธ๋ถ ์ ๋ณด๋ฅผ ๊ธฐ๋กํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค.
library(parallel)
library(data.table)
mclapply(1:2, sqrt)
์์ฐํ๋ค
*** caught illegal operation ***
address 0x7fffb500eae4, cause 'illegal opcode'
sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] parallel stats graphics utils datasets grDevices methods
[8] base
other attached packages:
[1] data.table_1.10.4-2 testthat_1.0.2 devtools_1.13.3
loaded via a namespace (and not attached):
[1] compiler_3.4.2 magrittr_1.5 R6_2.2.2 withr_2.0.0 crayon_1.3.4
[6] memoise_1.1.0 digest_0.6.12
์ฌ๋ฏธ์๊ฒ,
> remove.packages("data.table")
Removing package from โ/Library/Frameworks/R.framework/Versions/3.4/Resources/libraryโ
(as โlibโ is unspecified)
> install.packages("data.table", type = "source",
+ repos = "http://Rdatatable.github.io/data.table")
์์ฐํ๋ค
trying URL 'http://Rdatatable.github.io/data.table/src/contrib/data.table_1.10.5.tar.gz'
Content type 'application/gzip' length 3312726 bytes (3.2 MB)
==================================================
downloaded 3.2 MB
* installing *source* package โdata.tableโ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c assign.c -o assign.o
clang: error: unsupported option '-fopenmp'
make: *** [assign.o] Error 1
ERROR: compilation failed for package โdata.tableโ
* removing โ/Library/Frameworks/R.framework/Versions/3.4/Resources/library/data.tableโ
The downloaded source packages are in
โ/private/var/folders/48/q6ltldjs251000_wvjrdy_vm0000gn/T/Rtmp6eZFXj/downloaded_packagesโ
Warning message:
In install.packages("data.table", type = "source", repos = "http://Rdatatable.github.io/data.table") :
installation of package โdata.tableโ had non-zero exit status
๊ด๋ จ์ด ์๋์ง ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค
๋ํ https://github.com/Rdatatable/data.table/wiki/Installation ์ ์ง์นจ์ ๋ฐ๋๋๋ฐ ๋ฌธ์ ๊ฐ ๊ณ์ ๋ฐ์ํฉ๋๋ค....
ํธ์งํ๋ค:
mclapply
๋ฐ illegal operation
์ ์๋ ๋ฌธ์ (์ปดํ์ผ๋ฌ ์ค๋ฅ unsupported option '-fopenmp'
์๋ - ์ง์นจ์ ๋ฐ๋ผ ์์ ๋จ)
๋ชจ๋ ๊ณ ๋ง์์. 1.10.4๋ ์ ์์ ์ผ๋ก ์๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด์ง๋ง 1.10.4-2๋ ์๋ํ์ง ์๋๋ค๋ ์ ์ด ํฅ๋ฏธ๋กญ์ต๋๋ค. ํฌํฌ๊ฐ ํธ์ถ๋์๋ง์ ์ถฉ๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค. ์ ๊ฐ NEWS์์ ์ธ๊ธํ ์๋๋ ๋ฐ๋ก ๊ทธ ๋ถ๋ถ์ด์์ต๋๋ค.
์ฒซ์งธ, ๋ณํ์ง ์์ ๊ฒ. data.table์ ๋ก๋ํ ๋ init.c
๋ ๋ค์์ openmp-utils.c ์์ ํธ์ถํฉ๋๋ค.
void avoid_openmp_hang_within_fork() {
// Called once on loading data.table from init.c
#ifdef _OPENMP
pthread_atfork(&when_fork, NULL, NULL);
#endif
}
๋ฐ๋ผ์ parallel::mclapply
๊ฐ fork()
$ ๋ฅผ ํธ์ถํ๋ฉด when_fork
ํจ์๊ฐ ์คํ๋ฉ๋๋ค. 1.10.4-2์์ ๋ค์๊ณผ ๊ฐ์ด ๋ณด์
๋๋ค.
void when_fork() { # v 1.10.4-2
// attempted workaround for Intel's OpenMP implementation which leaves threads
// running after parallel region; these crash when forked.
#ifdef _OPENMP
omp_set_num_threads(1);
#endif
DTthreads = 1;
}
(1.10.4์์) ์ด์ ์๋ omp_set_num_threads(1)
๋ฅผ ํธ์ถํ๋ ๋ฐ ์ฌ์ฉ๋์ง ์์์ผ๋ฉฐ ์ ์ ๋ณ์ DTthreads
๋ฅผ ์ค์ ํ์ ๋ฟ์
๋๋ค.
void when_fork() { # v 1.10.4
DTthreads = 1;
}
๋ด๊ฐ ์๊ฐํ ์ ์๋ ๊ฒ์ omp_set_num_threads(1)
์ ๋ํ ํธ์ถ์ด ์ถฉ๋ํ๋ค๋ ๊ฒ๋ฟ์
๋๋ค. ๊ทธ๋ฌ๋ ์ด๊ฒ์ OpenMP์์ ํธ์ถํ ์ ์๋ ๊ฐ์ฅ ๊ฐ๋จํ ํจ์์
๋๋ค. ์๋ง๋ ๊ทธ๊ฒ์ ์ด๋ป๊ฒ ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ๋๋ก ๋ฐ์ธ๋ฉ๋์ง ์์์ต๋๊น?
parallel::mclapply
๋ฅผ ํธ์ถํ ๋ ์ถฉ๋์ ์ฌํํ ์ ์๋ ์ฌ๋๋ค์ ๊ฒฝ์ฐ parallel
ํจํค์ง๋ฅผ ๋ก๋ํ์ง ์๊ณ ์ ์ธ์
์์ ๊ฐ๋จํ fwrite()
๊ฐ ์ ์๋ํฉ๋๊น? ๋ง์ CPU๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๊น? ํ
์คํธํ๋ ค๋ฉด ํฐ DT
๊ฐ ํ์ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์์ ๋ฐ์ดํฐ์ ๋ํด 1๊ฐ์ ์ค๋ ๋๋ง ์ฌ์ฉํฉ๋๋ค. OpenMP๋ฅผ ์ฌ์ฉํ ๋ ์ถฉ๋์ด ๋ฐ์ํ๋ฉด ์ฐ๊ฒฐ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ์
๋๋ค. ๋งํฌ ๋ผ์ธ์ ์๋ ์ด ํ๋๊ทธ๊ฐ ๋ฌด์์ ์๋ฏธํ๋์ง ์๋ ์ฌ๋์ด ์์ต๋๊น? MacOS์์ ํ๋๊ทธ์ ๊ด๋ จ์ด ์์ ์ ์์ต๋๊น? : -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
dev์์ omp_set_num_threads(1)
์ ๋ํ ํธ์ถ์ ๋ค์ ์ ๊ฑฐํ๋ ค๊ณ ์๋ํ ์ ์์ผ๋ฉฐ ํ์ฌ 1.10.5์์ ๋ฌธ์ ๊ฐ ์๋ ์ฌ๋์ด ๋ด๊ฐ ๋ณ๊ฒฝํ ํ dev๋ฅผ ๋ค์ ์๋ํ ์ ์์ต๋๊น?
์ด์ํ ์ ์ ํ
์คํธ๊ฐ ์ถฉ๋ ์์ด MacOS์์ CRAN์ ํต๊ณผํ๋ค๋ ๊ฒ์
๋๋ค. parallel::mclapply
๋ฅผ ํธ์ถํ๋ ํ
์คํธ 1705 ํ
์คํธ์ ๋ชจ๋ ํ
์คํธ๋ 2๊ฐ์ ์ค๋ ๋๋ฅผ ์ฌ์ฉํ์ฌ CRAN์์ ์คํ๋ฉ๋๋ค. CRAN ๊ธฐ๊ณ์ ์ฌ๋๋ค์ด ๋ฌธ์ ๊ฐ ์๋ ๊ธฐ๊ณ์ ์ฐจ์ด์ ์ ๋ฌด์์
๋๊น?
@joethorley ์ด์ํ๋ค์. ์ฌ๊ธฐ ์์ MacOS ์ง์นจ์ ์คํํ ํ์๋ unsupported option '-fopenmp'
๋ฅผ ๋ฐ์ต๋๋ค. ๋ค๋ฅธ ์ฌ๋์ด ์งํ ๋ฐฉ๋ฒ์ ์ ์ํ ์ ์์ต๋๊น? ๋๋ ๊ธธ์ ์์๋ค.
@joethorley gettext๊ฐ ์ค์น๋์ด ์์ต๋๊น? ๋๋ํ์ง ์์๋ค. ์ผ๋จ ์๋ฃ๋๋ฉด ๋ด ์์คํ ์์ ํจํค์ง๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ปดํ์ผํ ์ ์์์ต๋๋ค.
@mattdowle ์๋์ unsupported option '-fopenmp'
์ค๋ฅ๋ ์ฌ๊ธฐ ์ ์ง์นจ์ ๋ฐ๋์ง๋ง ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
*** caught illegal operation ***
address 0x7fffb500eae4, cause 'illegal opcode'
๋ฐ์ํ์ต๋๋ค.
๋ด Makevars๋
CC=/usr/local/opt/llvm/bin/clang -fopenmp
CXX=/usr/local/opt/llvm/bin/clang++
# -O3 should be faster than -O2 (default) level optimisation ..
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include
๋ด ์ธ์ ์ ๋ณด()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics utils datasets grDevices methods base
other attached packages:
[1] testthat_1.0.2 devtools_1.13.3
loaded via a namespace (and not attached):
[1] compiler_3.4.2 magrittr_1.5 R6_2.2.2 withr_2.0.0 crayon_1.3.4
[6] memoise_1.1.0 digest_0.6.12
๋ด R ์ธ์
> remove.packages("data.table")
Removing package from โ/Library/Frameworks/R.framework/Versions/3.4/Resources/libraryโ
(as โlibโ is unspecified)
> install.packages("data.table", type = "source", repos = "http://Rdatatable.github.io/data.table")
trying URL 'http://Rdatatable.github.io/data.table/src/contrib/data.table_1.10.5.tar.gz'
Content type 'application/gzip' length 3312684 bytes (3.2 MB)
==================================================
downloaded 3.2 MB
* installing *source* package โdata.tableโ ...
** libs
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c assign.c -o assign.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c between.c -o between.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c bmerge.c -o bmerge.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c chmatch.c -o chmatch.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c dogroups.c -o dogroups.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fastmean.c -o fastmean.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fcast.c -o fcast.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fmelt.c -o fmelt.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c forder.c -o forder.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c frank.c -o frank.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fread.c -o fread.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c freadR.c -o freadR.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fsort.c -o fsort.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwrite.c -o fwrite.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwriteR.c -o fwriteR.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c gsumm.c -o gsumm.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c ijoin.c -o ijoin.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c init.c -o init.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c inrange.c -o inrange.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c openmp-utils.c -o openmp-utils.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c quickselect.c -o quickselect.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c rbindlist.c -o rbindlist.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c reorder.c -o reorder.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c shift.c -o shift.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c subset.c -o subset.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c transpose.c -o transpose.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c uniqlist.c -o uniqlist.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c vecseq.c -o vecseq.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c wrappers.c -o wrappers.o
/usr/local/opt/llvm/bin/clang -fopenmp -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -o data.table.so assign.o between.o bmerge.o chmatch.o dogroups.o fastmean.o fcast.o fmelt.o forder.o frank.o fread.o freadR.o fsort.o fwrite.o fwriteR.o gsumm.o ijoin.o init.o inrange.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o subset.o transpose.o uniqlist.o vecseq.o wrappers.o -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
mv data.table.so datatable.so
if [ "" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable.so datatable.so; fi
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/data.table/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (data.table)
The downloaded source packages are in
โ/private/var/folders/48/q6ltldjs251000_wvjrdy_vm0000gn/T/RtmpWku3yc/downloaded_packagesโ
> library(parallel)
> library(data.table)
data.table 1.10.5 IN DEVELOPMENT built 2017-10-18 23:12:32 UTC; travis
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
Release notes, videos and slides: http://r-datatable.com
> mclapply(1:2, sqrt)
*** caught illegal operation ***
address 0x7fffb500eae4, cause 'illegal opcode'
@mattdowle
fwrite()
๊ฐ ๋ด ์ปดํจํฐ์์ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.> mtcars <- rbind(mtcars, mtcars)
> nrow(mtcars)
[1] 16777216
> fwrite(mtcars, "mtcars.csv")
Written 45.1% of 16777216 rows in 2 secs using 8 threads. anyBufferGrown=no; max
Written 69.5% of 16777216 rows in 3 secs using 8 threads. anyBufferGrown=no; max
Written 93.9% of 16777216 rows in 4 secs using 8 threads. anyBufferGrown=no; max
@asenabouth gettext๊ฐ ์ค์น๋์ด ์๊ณ ์ง์นจ์ ๋ฐ๋ฅด๋ฉด ํจํค์ง๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ปดํ์ผํ ์ ์์์ต๋๋ค. ์ ๊ธ์ด ์ข ์ ๋งคํด์ ์์ ํ์ต๋๋ค.
@mattdowle
์์ค ๋๋ ๋ฐ์ด๋๋ฆฌ CRAN์์ 1.10.4.2๋ฅผ ์ค์นํ๋ฉด mclapply๊ฐ ์ค๋จ๋ฉ๋๋ค. github.com/Rdatatable/data๋ฅผ ์ค์นํฉ๋๋ค. ์์ค์ table@master ๋ ์ฌ์ ํ ์๋์ mclapply ์ค๋จ์ ์์ฑํ์ต๋๋ค.
ํ์ฌ ๋ง์คํฐ์ ์์ ๋ ๋ฒ์ ์ค์น
$ git diff
diff --git a/src/openmp-utils.c b/src/openmp-utils.c
index d6e3b70..bf104fc 100644
--- a/src/openmp-utils.c
+++ b/src/openmp-utils.c
@@ -78,7 +78,7 @@ void when_fork() {
void avoid_openmp_hang_within_fork() {
// Called once on loading data.table from init.c
#ifdef _OPENMP
- pthread_atfork(&when_fork, NULL, NULL);
+// pthread_atfork(&when_fork, NULL, NULL);
#endif
}
```
or this version
$ ์์ ์ฐจ์ด
diff --git a/src/openmp-utils.cb/src/openmp-utils.c
์์ธ d6e3b70..8c0236d 100644
--- a/src/openmp-utils.c
+++ b/src/openmp-utils.c
@@ -62,7 +62,7 @@ ๋ฌดํจ when_fork() {
// Intel์ OpenMP ๊ตฌํ์ ๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์๋ํ ํ ์ค๋ ๋๋ฅผ ๊ณ์ ์คํ
// ๋ณ๋ ฌ ์์ญ; ์ด๋ฌํ ์ถฉ๋์ ๋ถ๊ธฐ๋ ๋ ๋ฐ์ํฉ๋๋ค.
#ifdef _OPENMP
// GNU OpenMP๋ ๋ค์ ๋ณ๋ ฌ ์์ญ์ ์ ํํ๋ DTthreads๋ฅผ 1๋ก ์ค์ ํ๋ฉด ๊ด์ฐฎ์ ๋ณด์ ๋๋ค.
clears the hang for me.
The R we use (installed as a binary from CRAN) is the 3.4.2 release
R.๋ฒ์
_
ํ๋ซํผ x86_64-apple-darwin15.6.0
์์น x86_64
OS darwin15.6.0
์์คํ x86_64, darwin15.6.0
์ํ
๋ฉ์ด์ 3
๋ง์ด๋ 4.2
2017๋
09์
28์ผ
svn rev 73368
์ธ์ด R
version.string R ๋ฒ์ 3.4.2(2017-09-28)
๋ณ๋ช ์งง์ ์ฌ๋ฆ
```
ํ๊ฒฝ ๋ณ์ OMP_NUM_THREADS=2๋ฅผ ์ค์ ํด๋ ๊ฒฐ๊ณผ๊ฐ ๋ณ๊ฒฝ๋์ง ์์์ต๋๋ค.
when_fork()
omp_set_num_threads(1);
์ฃผ์ ์ฒ๋ฆฌ๋ฅผ ํ์ธํ๋ฉด ๋ด ์ปดํจํฐ์ ๋ฌธ์ ๋ ํด๊ฒฐ๋ฉ๋๋ค.
> mclapply(1:2, sqrt)
[[1]]
[1] 1
[[2]]
[1] 1.414214
๊ฐ์ฌํฉ๋๋ค. dev์์ ์์ ํ์ผ๋ฉฐ ํต๊ณผ ์ค์ ๋๋ค. @joethorley ๋น์ ์ด๋ ๋ค๋ฅธ ๋๊ตฐ๊ฐ๊ฐ ์ต์ 1.10.5๊ฐ ์ง๊ธ ๊ด์ฐฎ์์ง ํ์ธํ์๊ฒ ์ต๋๊น? CRAN์ผ๋ก ๊ฐ๊ธฐ ์ํด 1.10.4-3 ์ค๋น๋ฅผ ์์ํ๊ฒ ์ต๋๋ค.
@mattdowle
๊ณ ์ ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
$ R
R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> remove.packages("data.table")
Removing package from โ/Library/Frameworks/R.framework/Versions/3.4/Resources/libraryโ
(as โlibโ is unspecified)
> install.packages("data.table", type = "source", repos = "http://Rdatatable.github.io/data.table")
trying URL 'http://Rdatatable.github.io/data.table/src/contrib/data.table_1.10.5.tar.gz'
Content type 'application/gzip' length 3313284 bytes (3.2 MB)
==================================================
downloaded 3.2 MB
* installing *source* package โdata.tableโ ...
** libs
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c assign.c -o assign.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c between.c -o between.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c bmerge.c -o bmerge.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c chmatch.c -o chmatch.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c dogroups.c -o dogroups.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fastmean.c -o fastmean.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fcast.c -o fcast.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fmelt.c -o fmelt.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c forder.c -o forder.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c frank.c -o frank.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fread.c -o fread.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c freadR.c -o freadR.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fsort.c -o fsort.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwrite.c -o fwrite.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c fwriteR.c -o fwriteR.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c gsumm.c -o gsumm.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c ijoin.c -o ijoin.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c init.c -o init.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c inrange.c -o inrange.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c openmp-utils.c -o openmp-utils.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c quickselect.c -o quickselect.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c rbindlist.c -o rbindlist.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c reorder.c -o reorder.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c shift.c -o shift.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c subset.c -o subset.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c transpose.c -o transpose.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c uniqlist.c -o uniqlist.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c vecseq.c -o vecseq.o
/usr/local/opt/llvm/bin/clang -fopenmp -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include -fopenmp -fPIC -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c wrappers.c -o wrappers.o
/usr/local/opt/llvm/bin/clang -fopenmp -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -o data.table.so assign.o between.o bmerge.o chmatch.o dogroups.o fastmean.o fcast.o fmelt.o forder.o frank.o fread.o freadR.o fsort.o fwrite.o fwriteR.o gsumm.o ijoin.o init.o inrange.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o subset.o transpose.o uniqlist.o vecseq.o wrappers.o -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
mv data.table.so datatable.so
if [ "" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable.so datatable.so; fi
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/data.table/libs
** R
** inst
** byte-compile and prepare package for lazy loading
session** help
In*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (data.table)
The downloaded source packages are in
โ/private/var/folders/48/q6ltldjs251000_wvjrdy_vm0000gn/T/RtmpmAMLnD/downloaded_packagesโ
> library(parallel)
> library(data.table)
data.table 1.10.5 IN DEVELOPMENT built 2017-10-19 19:32:41 UTC; travis
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
Release notes, videos and slides: http://r-datatable.com
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] parallel stats graphics utils datasets grDevices methods
[8] base
other attached packages:
[1] data.table_1.10.5 testthat_1.0.2 devtools_1.13.3
loaded via a namespace (and not attached):
[1] compiler_3.4.2 magrittr_1.5 R6_2.2.2 tools_3.4.2 withr_2.0.0
[6] crayon_1.3.4 memoise_1.1.0 digest_0.6.12
> mclapply(1:2, sqrt)
[[1]]
[1] 1
[[2]]
[1] 1.414214
@joethorley ๊ฐ์ฌํฉ๋๋ค! CRAN์ 1.10.4-3์ ์ ์ถํ๊ณ ๋ชจ๋ ๊ฒ์ด ์๋๊ณ ์์ผ๋ฉฐ CRAN์ ๋ง๋ฒ์ด ๊ทธ ๊ณผ์ ์ ์คํํ๋ ๋ฐ ๋ฉฐ์น ์ด ๊ฑธ๋ฆด ๊ฒ์ ๋๋ค.
v1.10.4-3์ ๋ณ๊ฒฝ ์ฌํญ(CRAN์์ 2017๋ 10์ 20์ผ)
parallel::mclapply
๊ฐ ์ฌ์ฉ๋๊ณ data.table์ด ๋ก๋๋ ๋ MacOS์์ ์ถฉ๋/์ ์ง๊ฐ ์์ ๋์์ต๋๋ค( #2418 ). ์ด์ํ๊ฒ๋ ํ ์คํธ 1705(data.table๋กmclapply
ํ ์คํธ)๋ฅผ ํฌํจํ ๋ชจ๋ ํ ์คํธ๊ฐ CRAN์์ ์ ์์ ์ผ๋ก ํต๊ณผํ์ต๋๋ค. MacOS์ ์ผ๋ถ ๋ฒ์ ๋๋ MacOS์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฒ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๋ณด๊ณ ํ๊ณ ์ด ์์ ์ฌํญ์ด ์๋ํ๋์ง ํ์ธํด์ค Martin Morgan์๊ฒ ๊น์ ๊ฐ์ฌ๋ฅผ ๋๋ฆฝ๋๋ค. ๋ํ asenabouth, Joe Thorley ๋ฐ Danton Noriega ๋๋ถ์ data.table ๋ด๋ถ์ ์๋ ๋ณ๋ ฌ ์ฒ๋ฆฌ(์:fwrite
)๊ฐ ์ด๋ฌํ MacOS ์ค์น์์๋ ์ ์๋ํ๋์ง ํ ์คํธ, ๋๋ฒ๊น ๋ฐ ํ์ธํ์ต๋๋ค. 1.10.4-1 ๋ฐ 1.10.4-2์ ๋ํ ์๋ ๋ด์ค ํญ๋ชฉ๋ ์ฐธ์กฐํ์ญ์์ค.
์ง๊ธ์ ๋ฌธ์ ๋ซ์ต๋๋ค. 1.10.4-3์ ๋ฌธ์ ๊ฐ ์์ผ๋ฉด ๋ค์ ์ด๊ฑฐ๋ ์ ๋ฌธ์ ๋ฅผ ์ฌ์ญ์์ค.
@mattdowle : v1.10.4-2๊ฐ ์ฌ์ ํ CRAN์์ ๋ฐฐํฌํ๋ ๋ฒ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค. v1.10.4-3์ด ์ฌ์ ํ CRAN ์ ์ถ ๋๊ธฐ์ด์์ ๋๊ธฐ ์ค์ ๋๊น, ์๋๋ฉด ๋ค๋ฅธ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๊น?
(์ด ๋ฌธ์ ์ ๋ํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋๋ฌด ๋นจ๋ฆฌ ์๋ ค์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ๋ถํํ๋ macOS์ ๋ง์ ์ฌ์ฉ์์๊ฒ ์ํฅ์ ๋ฏธ์น๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค)
@kevinushey ์ 1.10.4-3์ด ๋๊ธฐ์ด์์ ๊ธฐ๋ค๋ฆฌ๊ณ ์์์ต๋๋ค(6์ผ ๋์ ๊ทธ๊ฒ์ด ์๋ฏธํ๋ ๋ฐ๋ฅผ ๋ชจ๋ฅด๋ '์ฌํ์ธ' ์ํ์์). CRAN์ ์ด๋ฉ์ผ์ ๋ณด๋๊ณ ์ด์ CRAN์ ๊ณต๊ฐ๋์์ต๋๋ค.
์ด์ฉ๋ฉด ๋ด๊ฐ ๋ญ๊ฐ ์๋ชปํ๊ณ ์์ง๋ง ์ฌ์ ํ ๋ด Mac์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] httr_1.3.1 compiler_3.4.1 R6_2.2.2 tools_3.4.1 withr_2.0.0 curl_3.0
[7] yaml_2.1.14 memoise_1.1.0 knitr_1.17 git2r_0.19.0 digest_0.6.12 devtools_1.13.3
์์ค์์ ํฌ๋ ๋ฒ์ ์ ์ค์นํ ๋ ๋ค์์ ์ป์ต๋๋ค.
> install.packages("data.table", type = "source", repos = "https://cran.rstudio.com")
essai de l'URL 'https://cran.rstudio.com/src/contrib/data.table_1.10.4-3.tar.gz'
Content type 'application/x-gzip' length 3071833 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package โdata.tableโ ...
** package โdata.tableโ correctement dรฉcompressรฉ et sommes MD5 vรฉrifiรฉes
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -c assign.c -o assign.o
clang: error: unsupported option '-fopenmp'
make: *** [assign.o] Error 1
ERROR: compilation failed for package โdata.tableโ
* removing โ/Library/Frameworks/R.framework/Versions/3.4/Resources/library/data.tableโ
* restoring previous โ/Library/Frameworks/R.framework/Versions/3.4/Resources/library/data.tableโ
Les packages source tรฉlรฉchargรฉs sont dans
โ/private/var/folders/51/6jygptvs3bb4njv0t6x7br900000gn/T/Rtmp8NJ0di/downloaded_packagesโ
Warning message:
In install.packages("data.table", type = "source", repos = "https://cran.rstudio.com") :
l'installation du package โdata.tableโ a eu un statut de sortie non nul
ํ์ํ ๊ฒฝ์ฐ ๋ ์์ธํ ์ ๋ณด๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค.
@davidgohel : R LLVM ํด์ฒด์ธ์ ๋ก์ปฌ์ ์ค์นํ๋ ค๋ฉด ์ด ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์. http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/
๋๋ R.home("etc/Makeconf")
์์ ํ์ผ์ ํธ์งํ๊ณ ๊ฑฐ๊ธฐ์ ๋ณด์ด๋ -fopenmp
์ ์ธ์คํด์ค๋ฅผ ์ ๊ฑฐํ์ฌ ์ปดํ์ผ ์ Apple ์์คํ
๋๊ตฌ ๋ชจ์๊ณผ ํจ๊ป OpenMP๋ฅผ ์ฌ์ฉํ์ง ์๋๋ก ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
@kevinushey ์๊ฒ ์ต๋๋ค. ๋์ฒด ์๋ฃจ์ ์ ์ฌ์ฉํด ๋ณด๊ฒ ์ต๋๋ค. ๋๋ ์ฒซ ๋ฒ์งธ ์๋ฃจ์ ์ผ๋ก ๋ญ๊ฐ๋ฅผ ๋ง์ณค๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ด๊ฒ์ ๋ด ~/.R/Makevars
ํ์ผ์ ์ถ๊ฐํ๋ฉด High Sierra์์ OpenMP ์์ด data.table์ ์ปดํ์ผํ ์ ์์ต๋๋ค.
# Suppress `-fopenmp` in R.home("etc/Makeconf")
# MAIN_LDFLAGS = -fopenmp
# SHLIB_OPENMP_CFLAGS = -fopenmp
# SHLIB_OPENMP_CXXFLAGS = -fopenmp
# SHLIB_OPENMP_FCFLAGS = -fopenmp
# SHLIB_OPENMP_FFLAGS = -fopenmp
MAIN_LDFLAGS =
SHLIB_OPENMP_CFLAGS =
SHLIB_OPENMP_CXXFLAGS =
SHLIB_OPENMP_FCFLAGS =
SHLIB_OPENMP_FFLAGS =
@mjsteinbaugh @kevinushey ๊ฐ์ฌํฉ๋๋ค, ํจ๊ณผ๊ฐ ์์์ต๋๋ค
R.home("etc/Makeconf")
์์ ํ์ผ ํธ์ง์ ์๋ํ์ง๋ง ํธ์งํ ์ ์์ต๋๋ค. ๋ํ ~/.R/Makevars
๋ผ๋ ํ์ผ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ถ๊ฐ ์ ์: ๊ฐ์ฌํฉ๋๋ค.
@ValeriVoev ~/.R/Makevars
์ ์๋ ํ์ผ์ ์ผ๋ฐ์ ์ผ๋ก ์กด์ฌํ์ง ์์ต๋๋ค. ์ง์ ๋ง๋ค์ด์ผ ํฉ๋๋ค. (์ฆ, ํ ๋๋ ํฐ๋ฆฌ์ .R
๋ผ๋ ํด๋๋ฅผ ๋ง๋ ๋ค์ ํด๋น ํด๋ ์์ Makevars
ํ์ผ์ ๋ง๋ญ๋๋ค.)
@kevinushey ๊ฐ์ฌํฉ๋๋ค - ๋ง์นจ๋ด ์๋ํ๊ฒ ํ๊ณ data.table
1.10.4-3์ ์ค์นํ๊ณ R Studio๊ฐ ๋ ์ด์ ์ถฉ๋ํ์ง ์์ต๋๋ค. ๋๋ ๋ํ clang์ ์ค์นํ์ต๋๋ค - ๊ทธ๊ฒ์ด ๋์์ด ๋์๋์ง ์ฌ๋ถ๋ ํ์คํ์ง ์์ต๋๋ค.
์ฌ์ ํ ์ด ์ค๋ฅ๊ฐ ๋ฌด์์๋ก ํ์๋ฉ๋๋ค.
Assertion failure at kmp_runtime.cpp(6480): __kmp_thread_pool == __null.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6480).
OMP: Hint: Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/.
๊ทธ๋ฆฌ๊ณ ์ฌ๊ฑด์ ์ ๋ง ๋ํดํ๋ค.
mclapply(1:2, sqrt)
๋ฅผ ๋ฃ์ผ๋ฉด ๋น๋คํธ ๋จ๊ฐ์ง์ ๋ ์ด์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ง ์์ต๋๋ค!์ด๋ ๋ชจ๋ ํ๊ฒฝ ๋ณํ์ ๊ด๋ จ์ด ์๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. ๋ถํํ๋ ์ง๊ธ์ ๊ฐ๋จํ๊ฒ ์ฌํํ ์ ์๋ ์์ ๊ฐ ์์ต๋๋ค. ๋ด ์ฝ๋๋ ๋งค์ฐ ๋ณต์กํ๊ณ ๋ค๋ฅธ ๋ง์ ๊ฒ๋ค์ ํฌํจํฉ๋๋ค.
dracodoc๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก (6480)์ด ๋ฌด์์๋ก ์ก๋๋ก ํฉ๋๋ค. macOS 10.13.3, R 3.4.3, data.table 1.10.4-3. ์ฌ๊ธฐ์๋ ์ผ๋ฐ R๋ง ์๊ณ ์ฌํํ๊ธฐ์๋ ๋๋ฌด ๋ณต์กํ ์ฝ๋์ ๋๋ค.
์ฝ๋ ์์ ๋ถ๋ถ์ ์๋ ๊ฐ๋จํ mclapply๊ฐ ์๋ํ๊ณ ๋๋ก๋ ๋๋จธ์ง ์ฝ๋๋ ์๋ํ๊ฒ ํฉ๋๋ค. ์ ๊ฒฝ์ฐ์๋ mclapply(1:2, sqrt)
๋ฅผ ์ถ๊ฐํด๋ ํธ๋ฆญ์ด ์๋ํ์ง ์์ง๋ง ๊ฒ๋ณด๊ธฐ์ ์์์ ํ์์ ์๋๋ฅผ ์คํํ๋ฉด ๋ฉ๋๋ค(์ด์ for (i in 1:10) mclapply(1:10000000, sqrt)
๋ก ์ฝ๋ ์์).
ํธ์ง: ์์, ์คํ์ด ์์ ์ ์ด์ง ์์ ๊ฒ ๊ฐ์ผ๋ฉฐ mcmapply๊ฐ ์์๋์ง๋ง ์ ์ ํ ์ค๋จ๋ฉ๋๋ค.
์ด ์ถ๊ฐ ๋๊ธ์ ์ด์ ์์ผ ๋ดค์ต๋๋ค. dev 1.10.5๋ฅผ ์๋ํ๊ฑฐ๋ ๋ค์ CRAN ๋ฆด๋ฆฌ์ค๋ฅผ ๊ธฐ๋ค๋ฆฌ์ญ์์ค. ๊ทธ ํ์๋ ๋ฌธ์ ๊ฐ ๊ณ์๋๋ฉด ์ ๋ฌธ์ ๋ฅผ ์ ๊ธฐํ์ญ์์ค.
dev 1.10.5์์ ์ฌ์ ํ ๋์ผํ ๋ฌธ์ ๊ฐ ํ์๋ฉ๋๋ค. ์ ๋ฌธ์ ๊ฐ ์์ฑ๋์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@davidgohel : R LLVM ํด์ฒด์ธ์ ๋ก์ปฌ์ ์ค์นํ๋ ค๋ฉด ์ด ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์. http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/
๋๋
R.home("etc/Makeconf")
์์ ํ์ผ์ ํธ์งํ๊ณ ๊ฑฐ๊ธฐ์ ๋ณด์ด๋-fopenmp
์ ์ธ์คํด์ค๋ฅผ ์ ๊ฑฐํ์ฌ ์ปดํ์ผ ์ Apple ์์คํ ๋๊ตฌ ๋ชจ์๊ณผ ํจ๊ป OpenMP๋ฅผ ์ฌ์ฉํ์ง ์๋๋ก ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.