HOGWILD! on Rust

Eab7ee60953b205a8324d111bf33c960?s=47 ctylim
November 19, 2019

HOGWILD! on Rust

RustのLT会 Shinjuku.rs #7 @FORCIA のLT資料です。
https://forcia.connpass.com/event/146253/

Eab7ee60953b205a8324d111bf33c960?s=128

ctylim

November 19, 2019
Tweet

Transcript

  1. HOGWILD! on Rust 1 2019/11/19 Shinjuku.rs #7

  2. 自己紹介 2 プロフィール  GitHub@ctylim  Bulbit Inc. ソフトウェアエンジニア  言語: Rust, Go,

    Python3 趣味  AtCoder: 黄色(max 2254), C++  beatmania IIDX: SP 皆伝, DP 七段
  3. 最適化問題を計算機で解く 3 以下の目的関数を最小化するモデル  を求めよ。 xi <latexit sha1_base64="/qtXF60Z1QSJI+1XWOFk4mf6g5E=">AAACdXichVHLSsNAFD2Nr1pfUTeCCMWquKpTFV+rohuX2lotWClJnOpgXiRpsZb+gD/gQjcKKuJnuPEHXPgJ4rJCNy68SYMiot6QuWfO3HPnzIxq68L1GHuOSG3tHZ1d0e5YT29f/4A8OLTtWmVH4znN0i0nryou14XJc57wdJ63Ha4Yqs531KM1f32nwh1XWOaWV7X5nqEcmKIkNMUjqijLBdXS992qQal2XC+KopxgSRZE/CdIhSCBMDYs+RYF7MOChjIMcJjwCOtQ4NK3ixQYbOL2UCPOISSCdY46YqQtUxWnCoXYIxoPaLYbsibN/Z5uoNZoF51+h5RxTLIndsca7JHdsxf2/muvWtDD91KlrLa03C4OnI5km/+qDMoeDr9Uf3r2UMJS4FWQdztg/FNoLX3l5KyRXclM1qbYFXsl/5fsmT3QCczKm3a9yTPniAUPsOzHwud1/wTbs8nUXHJ+cz6RXg2fIopRjGOa7nsRaaxjAznat4ILXOMm0pTGpAlpqlUqRULNML6FNPMBoJeRSg==</latexit> yi <latexit sha1_base64="98pqH8Do4ubC3qQ5h93CFdHkzj4=">AAACZnichVHLSgMxFD0dX7W+qiIKboql4qqkWnytim5cqrVVqKXMjGkNzouZaaEWf0BwaxeuFETEz3DjD7jwDxSXFdy48M50UKSoNyQ5Obnn5iRRLE04LmNPIamru6e3L9wfGRgcGh6Jjo7lHbNqqzynmppp7ymywzVh8JwrXI3vWTaXdUXju8rRure/W+O2I0xjx61bvKjLFUOUhSq7RGXrJVGKxlmS+RHrBKkAxBHEphm9wT4OYEJFFTo4DLiENchwqBWQAoNFXBEN4mxCwt/nOEGEtFXK4pQhE3tEY4VWhYA1aO3VdHy1Sqdo1G1SxpBgj+yWtdgDu2Mv7OPXWg2/huelTrPS1nKrNHI6lX3/V6XT7OLwW/WnZxdlLPteBXm3fMa7hdrW146brezqdqIxy67YK/m/ZE/snm5g1N7U6y2+fYGI/wErXix+PXcnyM8nUwvJ9FY6nlkLviKMacxgjt57CRlsYBM5OreCM5yjGXqWhqUJabKdKoUCzTh+hBT7BO2Xiw0=</latexit> l(y,

    x) <latexit sha1_base64="DU4wuhRwABnRg2DEZulO9639uhU=">AAACeXichVHLSsNAFD2Nr1pf9bEQ3FSLUkXK1BZfK9GNS19VwZaSpFMNnTxI0mIt/oA/4MKNCiLqZ7jxB1z4CeJSwYUuvEmDIqLekLlnztxz58yMYgnNcRl7CElNzS2tbeH2SEdnV3dPtLdv0zErtsqzqilMe1uRHS40g2ddzRV827K5rCuCbynlJW99q8ptRzONDbdm8bwu7xpaSVNll6hCdEAkapOxnGKKolPTKdX3D8cL0ThLMj9iP0EqAHEEsWJGL5FDESZUVKCDw4BLWECGQ98OUmCwiMujTpxNSPPXOQ4RIW2FqjhVyMSWadyl2U7AGjT3ejq+WqVdBP02KWMYZffsij2zO3bDHtn7r73qfg/PS42y0tByq9BzNLj++q9Kp+xi70v1p2cXJcz6XjXybvmMdwq1oa8eHD+vz6+N1sfYOXsi/2fsgd3SCYzqi3qxytdOEPEfYM6L6c/r/gk2p5KpdDKzmokvLAZPEcYQRpCg+57BApaxgizte4BTXOE69CYNSwlpolEqhQJNP76FlP4AvFCSLA==</latexit> : ラベル(正解データ) : 学習データ : 損失関数 w <latexit sha1_base64="BDCkDdZlaFQYv2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wNSg2QxcwAgwRA9uTEaYkZ6hsZ5poImygxM0KjgYpBmUGDSA4W3O4MDgwRDAEAq0dzXDRYZbDLeZdJiCmCKZoiFKmRiheoQZUABTCgAcnqWA</latexit>
  4. for i in 0..n { } 最適化問題を計算機で解く 4 以下の目的関数を最小化するモデル  を求めよ。 xi

    <latexit sha1_base64="/qtXF60Z1QSJI+1XWOFk4mf6g5E=">AAACdXichVHLSsNAFD2Nr1pfUTeCCMWquKpTFV+rohuX2lotWClJnOpgXiRpsZb+gD/gQjcKKuJnuPEHXPgJ4rJCNy68SYMiot6QuWfO3HPnzIxq68L1GHuOSG3tHZ1d0e5YT29f/4A8OLTtWmVH4znN0i0nryou14XJc57wdJ63Ha4Yqs531KM1f32nwh1XWOaWV7X5nqEcmKIkNMUjqijLBdXS992qQal2XC+KopxgSRZE/CdIhSCBMDYs+RYF7MOChjIMcJjwCOtQ4NK3ixQYbOL2UCPOISSCdY46YqQtUxWnCoXYIxoPaLYbsibN/Z5uoNZoF51+h5RxTLIndsca7JHdsxf2/muvWtDD91KlrLa03C4OnI5km/+qDMoeDr9Uf3r2UMJS4FWQdztg/FNoLX3l5KyRXclM1qbYFXsl/5fsmT3QCczKm3a9yTPniAUPsOzHwud1/wTbs8nUXHJ+cz6RXg2fIopRjGOa7nsRaaxjAznat4ILXOMm0pTGpAlpqlUqRULNML6FNPMBoJeRSg==</latexit> yi <latexit sha1_base64="98pqH8Do4ubC3qQ5h93CFdHkzj4=">AAACZnichVHLSgMxFD0dX7W+qiIKboql4qqkWnytim5cqrVVqKXMjGkNzouZaaEWf0BwaxeuFETEz3DjD7jwDxSXFdy48M50UKSoNyQ5Obnn5iRRLE04LmNPIamru6e3L9wfGRgcGh6Jjo7lHbNqqzynmppp7ymywzVh8JwrXI3vWTaXdUXju8rRure/W+O2I0xjx61bvKjLFUOUhSq7RGXrJVGKxlmS+RHrBKkAxBHEphm9wT4OYEJFFTo4DLiENchwqBWQAoNFXBEN4mxCwt/nOEGEtFXK4pQhE3tEY4VWhYA1aO3VdHy1Sqdo1G1SxpBgj+yWtdgDu2Mv7OPXWg2/huelTrPS1nKrNHI6lX3/V6XT7OLwW/WnZxdlLPteBXm3fMa7hdrW146brezqdqIxy67YK/m/ZE/snm5g1N7U6y2+fYGI/wErXix+PXcnyM8nUwvJ9FY6nlkLviKMacxgjt57CRlsYBM5OreCM5yjGXqWhqUJabKdKoUCzTh+hBT7BO2Xiw0=</latexit> l(y, x) <latexit sha1_base64="DU4wuhRwABnRg2DEZulO9639uhU=">AAACeXichVHLSsNAFD2Nr1pf9bEQ3FSLUkXK1BZfK9GNS19VwZaSpFMNnTxI0mIt/oA/4MKNCiLqZ7jxB1z4CeJSwYUuvEmDIqLekLlnztxz58yMYgnNcRl7CElNzS2tbeH2SEdnV3dPtLdv0zErtsqzqilMe1uRHS40g2ddzRV827K5rCuCbynlJW99q8ptRzONDbdm8bwu7xpaSVNll6hCdEAkapOxnGKKolPTKdX3D8cL0ThLMj9iP0EqAHEEsWJGL5FDESZUVKCDw4BLWECGQ98OUmCwiMujTpxNSPPXOQ4RIW2FqjhVyMSWadyl2U7AGjT3ejq+WqVdBP02KWMYZffsij2zO3bDHtn7r73qfg/PS42y0tByq9BzNLj++q9Kp+xi70v1p2cXJcz6XjXybvmMdwq1oa8eHD+vz6+N1sfYOXsi/2fsgd3SCYzqi3qxytdOEPEfYM6L6c/r/gk2p5KpdDKzmokvLAZPEcYQRpCg+57BApaxgizte4BTXOE69CYNSwlpolEqhQJNP76FlP4AvFCSLA==</latexit> : ラベル(正解データ) : 学習データ : 損失関数 反復法(オンライン学習) w <latexit sha1_base64="BDCkDdZlaFQYv2OfnA9tPfBZVe0=">AAACcXichVHLSsNAFD2N7/po1Y3iprRUBKFMtfhaiW5cttU+oFZJ4rSG5kWSVmrxB/wBBVcWRMTPcOMPuPATxGUFNy68SYMiRb0hc8+cuefOmRnJVBXbYew5IPT1DwwODY8ER8fGJ0Lhyam8bdQtmedkQzWsoiTaXFV0nnMUR+VF0+KiJqm8INW23fVCg1u2Yuh7TtPkZU2s6kpFkUWHqIN9yVCP7KZGqXVydhiOsQTzItILkj6IwY+0Eb7FPo5gQEYdGjh0OIRViLDpKyEJBpO4MlrEWYQUb53jDEHS1qmKU4VIbI3GKs1KPqvT3O1pe2qZdlHpt0gZQZw9sTvWYY/snr2wj197tbwerpcmZamr5eZh6Hxm9/1flUbZwfG36k/PDipY87wq5N30GPcUclffOL3o7G5k46151mav5P+aPbMHOoHeeJNvMjx7haD3AOturHxddy/ILyWSy4lUJhXb3PKfYhhziGKB7nsVm9hBGjna18IlrtEOdIRZISJEu6VCwNdM40cIi58wRZA8</latexit> w w ⌘rF(w; yi, xi) <latexit sha1_base64="Ir3kGLckJLBBS34KDyCWUulU9JE=">AAACwnichVHLThRBFD00ymNQGGBD4qbDBIOJTGqE8JANUUNc8nCAhJ50qpsaLKh+0F0zOIzzA/6AC1eaGGL4DDb+gAs+gbBjSNy48HZPRzMhyq1U3Vvn3nPrVJUTKhlrxi56jN579/v6BwZzQw8eDo/kR8e24qAWuaLsBiqIdhweCyV9UdZSK7ETRoJ7jhLbzuHLJL9dF1EsA/+NboSi4vF9X1alyzVBdr5iOYHaixseueZxy7SUqGoeRcGx2Z2ZsYTmpuVzR3Fzdbo7uWw2bPm0i/GuZcsndr7Aiiw183ZQyoICMlsL8qewsIcALmrwIOBDU6zAEdPYRQkMIWEVNAmLKJJpXqCFHHFrVCWoghN6SOs+7XYz1Kd90jNO2S6domhGxDQxxX6wb6zNvrMzdsl+/bNXM+2RaGmQdzpcEdojHyY2f97J8shrvP3L+q9mjSoWU62StIcpktzC7fDrJx/bm883ppqP2Rd2Rfo/swt2Tjfw6zfu13Wx8Qm59AOWEpv/89y3g61nxdJscW59rrDyIvuKATzCJKbpvRewgtdYQ5nOPcclrtE2XhkHxpERd0qNnowzji4z3v8G71SwoQ==</latexit> L(w) = X i l(w; yi, xi) <latexit sha1_base64="YK2uwEofDp0zeTuBr2/c9hi7I98=">AAACqnicSyrIySwuMTC4ycjEzMLKxs7BycXNw8vHLyAoFFacX1qUnBqanJ+TXxSRlFicmpOZlxpaklmSkxpRUJSamJuUkxqelO0Mkg8vSy0qzszPCympLEiNzU1Mz8tMy0xOLAEKxQu4+mjEJOXnpBRX5gKp6vJaTQVbhZji0tz46sxahRw0SWuFyvhMHQVkwYra+EzNeAFlAz0DMFDAZBhCGcoMUBCQL7CcIYYhhSGfIZmhlCGXIZUhj6EEyM5hSGQoBsJoBkMGA4YCoFgsQzVQrAjIygTLpzLUMnAB9ZYCVaUCVSQCRbOBZDqQFw0VzQPyQWYWg3UnA23JAeIioE4FBlWDqwYrDT4bnDBYbfDS4A9Os6rBZoDcUgmkkyB6Uwvi+bskgr8T1JULpEsYMhC68Lq5hCGNwQLs1kyg2wvAIiBfJEP0l1VN/xxsFaRarWawyOA10P0LDW4aHAb6IK/sS/LSwNSg2QxcwAgwRA9uTEaYkZ6hsZ5poImygxM0KjgYpBmUGDSA4W3O4MDgwRDAEAq0dzXDRYZbDLeZdJiCmCKZoiFKmRiheoQZUABTCgAcnqWA</latexit>
  5. for i in 0..100000000 { } 最適化問題を計算機で解く 5 以下の目的関数を最小化するモデル  を求めよ。 xi

    <latexit sha1_base64="/qtXF60Z1QSJI+1XWOFk4mf6g5E=">AAACdXichVHLSsNAFD2Nr1pfUTeCCMWquKpTFV+rohuX2lotWClJnOpgXiRpsZb+gD/gQjcKKuJnuPEHXPgJ4rJCNy68SYMiot6QuWfO3HPnzIxq68L1GHuOSG3tHZ1d0e5YT29f/4A8OLTtWmVH4znN0i0nryou14XJc57wdJ63Ha4Yqs531KM1f32nwh1XWOaWV7X5nqEcmKIkNMUjqijLBdXS992qQal2XC+KopxgSRZE/CdIhSCBMDYs+RYF7MOChjIMcJjwCOtQ4NK3ixQYbOL2UCPOISSCdY46YqQtUxWnCoXYIxoPaLYbsibN/Z5uoNZoF51+h5RxTLIndsca7JHdsxf2/muvWtDD91KlrLa03C4OnI5km/+qDMoeDr9Uf3r2UMJS4FWQdztg/FNoLX3l5KyRXclM1qbYFXsl/5fsmT3QCczKm3a9yTPniAUPsOzHwud1/wTbs8nUXHJ+cz6RXg2fIopRjGOa7nsRaaxjAznat4ILXOMm0pTGpAlpqlUqRULNML6FNPMBoJeRSg==</latexit> yi <latexit sha1_base64="98pqH8Do4ubC3qQ5h93CFdHkzj4=">AAACZnichVHLSgMxFD0dX7W+qiIKboql4qqkWnytim5cqrVVqKXMjGkNzouZaaEWf0BwaxeuFETEz3DjD7jwDxSXFdy48M50UKSoNyQ5Obnn5iRRLE04LmNPIamru6e3L9wfGRgcGh6Jjo7lHbNqqzynmppp7ymywzVh8JwrXI3vWTaXdUXju8rRure/W+O2I0xjx61bvKjLFUOUhSq7RGXrJVGKxlmS+RHrBKkAxBHEphm9wT4OYEJFFTo4DLiENchwqBWQAoNFXBEN4mxCwt/nOEGEtFXK4pQhE3tEY4VWhYA1aO3VdHy1Sqdo1G1SxpBgj+yWtdgDu2Mv7OPXWg2/huelTrPS1nKrNHI6lX3/V6XT7OLwW/WnZxdlLPteBXm3fMa7hdrW146brezqdqIxy67YK/m/ZE/snm5g1N7U6y2+fYGI/wErXix+PXcnyM8nUwvJ9FY6nlkLviKMacxgjt57CRlsYBM5OreCM5yjGXqWhqUJabKdKoUCzTh+hBT7BO2Xiw0=</latexit> l(y, x) <latexit sha1_base64="DU4wuhRwABnRg2DEZulO9639uhU=">AAACeXichVHLSsNAFD2Nr1pf9bEQ3FSLUkXK1BZfK9GNS19VwZaSpFMNnTxI0mIt/oA/4MKNCiLqZ7jxB1z4CeJSwYUuvEmDIqLekLlnztxz58yMYgnNcRl7CElNzS2tbeH2SEdnV3dPtLdv0zErtsqzqilMe1uRHS40g2ddzRV827K5rCuCbynlJW99q8ptRzONDbdm8bwu7xpaSVNll6hCdEAkapOxnGKKolPTKdX3D8cL0ThLMj9iP0EqAHEEsWJGL5FDESZUVKCDw4BLWECGQ98OUmCwiMujTpxNSPPXOQ4RIW2FqjhVyMSWadyl2U7AGjT3ejq+WqVdBP02KWMYZffsij2zO3bDHtn7r73qfg/PS42y0tByq9BzNLj++q9Kp+xi70v1p2cXJcz6XjXybvmMdwq1oa8eHD+vz6+N1sfYOXsi/2fsgd3SCYzqi3qxytdOEPEfYM6L6c/r/gk2p5KpdDKzmokvLAZPEcYQRpCg+57BApaxgizte4BTXOE69CYNSwlpolEqhQJNP76FlP4AvFCSLA==</latexit> : ラベル(正解データ) : 学習データ : 損失関数 反復法(オンライン学習) w <latexit sha1_base64="BDCkDdZlaFQYv2OfnA9tPfBZVe0=">AAACcXichVHLSsNAFD2N7/po1Y3iprRUBKFMtfhaiW5cttU+oFZJ4rSG5kWSVmrxB/wBBVcWRMTPcOMPuPATxGUFNy68SYMiRb0hc8+cuefOmRnJVBXbYew5IPT1DwwODY8ER8fGJ0Lhyam8bdQtmedkQzWsoiTaXFV0nnMUR+VF0+KiJqm8INW23fVCg1u2Yuh7TtPkZU2s6kpFkUWHqIN9yVCP7KZGqXVydhiOsQTzItILkj6IwY+0Eb7FPo5gQEYdGjh0OIRViLDpKyEJBpO4MlrEWYQUb53jDEHS1qmKU4VIbI3GKs1KPqvT3O1pe2qZdlHpt0gZQZw9sTvWYY/snr2wj197tbwerpcmZamr5eZh6Hxm9/1flUbZwfG36k/PDipY87wq5N30GPcUclffOL3o7G5k46151mav5P+aPbMHOoHeeJNvMjx7haD3AOturHxddy/ILyWSy4lUJhXb3PKfYhhziGKB7nsVm9hBGjna18IlrtEOdIRZISJEu6VCwNdM40cIi58wRZA8</latexit> w w ⌘rF(w; yi, xi) <latexit sha1_base64="Ir3kGLckJLBBS34KDyCWUulU9JE=">AAACwnichVHLThRBFD00ymNQGGBD4qbDBIOJTGqE8JANUUNc8nCAhJ50qpsaLKh+0F0zOIzzA/6AC1eaGGL4DDb+gAs+gbBjSNy48HZPRzMhyq1U3Vvn3nPrVJUTKhlrxi56jN579/v6BwZzQw8eDo/kR8e24qAWuaLsBiqIdhweCyV9UdZSK7ETRoJ7jhLbzu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最適化問題を計算機で解く 6 以下の目的関数を最小化するモデル  を求めよ。 xi

    <latexit sha1_base64="/qtXF60Z1QSJI+1XWOFk4mf6g5E=">AAACdXichVHLSsNAFD2Nr1pfUTeCCMWquKpTFV+rohuX2lotWClJnOpgXiRpsZb+gD/gQjcKKuJnuPEHXPgJ4rJCNy68SYMiot6QuWfO3HPnzIxq68L1GHuOSG3tHZ1d0e5YT29f/4A8OLTtWmVH4znN0i0nryou14XJc57wdJ63Ha4Yqs531KM1f32nwh1XWOaWV7X5nqEcmKIkNMUjqijLBdXS992qQal2XC+KopxgSRZE/CdIhSCBMDYs+RYF7MOChjIMcJjwCOtQ4NK3ixQYbOL2UCPOISSCdY46YqQtUxWnCoXYIxoPaLYbsibN/Z5uoNZoF51+h5RxTLIndsca7JHdsxf2/muvWtDD91KlrLa03C4OnI5km/+qDMoeDr9Uf3r2UMJS4FWQdztg/FNoLX3l5KyRXclM1qbYFXsl/5fsmT3QCczKm3a9yTPniAUPsOzHwud1/wTbs8nUXHJ+cz6RXg2fIopRjGOa7nsRaaxjAznat4ILXOMm0pTGpAlpqlUqRULNML6FNPMBoJeRSg==</latexit> yi <latexit sha1_base64="98pqH8Do4ubC3qQ5h93CFdHkzj4=">AAACZnichVHLSgMxFD0dX7W+qiIKboql4qqkWnytim5cqrVVqKXMjGkNzouZaaEWf0BwaxeuFETEz3DjD7jwDxSXFdy48M50UKSoNyQ5Obnn5iRRLE04LmNPIamru6e3L9wfGRgcGh6Jjo7lHbNqqzynmppp7ymywzVh8JwrXI3vWTaXdUXju8rRure/W+O2I0xjx61bvKjLFUOUhSq7RGXrJVGKxlmS+RHrBKkAxBHEphm9wT4OYEJFFTo4DLiENchwqBWQAoNFXBEN4mxCwt/nOEGEtFXK4pQhE3tEY4VWhYA1aO3VdHy1Sqdo1G1SxpBgj+yWtdgDu2Mv7OPXWg2/huelTrPS1nKrNHI6lX3/V6XT7OLwW/WnZxdlLPteBXm3fMa7hdrW146brezqdqIxy67YK/m/ZE/snm5g1N7U6y2+fYGI/wErXix+PXcnyM8nUwvJ9FY6nlkLviKMacxgjt57CRlsYBM5OreCM5yjGXqWhqUJabKdKoUCzTh+hBT7BO2Xiw0=</latexit> l(y, x) <latexit sha1_base64="DU4wuhRwABnRg2DEZulO9639uhU=">AAACeXichVHLSsNAFD2Nr1pf9bEQ3FSLUkXK1BZfK9GNS19VwZaSpFMNnTxI0mIt/oA/4MKNCiLqZ7jxB1z4CeJSwYUuvEmDIqLekLlnztxz58yMYgnNcRl7CElNzS2tbeH2SEdnV3dPtLdv0zErtsqzqilMe1uRHS40g2ddzRV827K5rCuCbynlJW99q8ptRzONDbdm8bwu7xpaSVNll6hCdEAkapOxnGKKolPTKdX3D8cL0ThLMj9iP0EqAHEEsWJGL5FDESZUVKCDw4BLWECGQ98OUmCwiMujTpxNSPPXOQ4RIW2FqjhVyMSWadyl2U7AGjT3ejq+WqVdBP02KWMYZffsij2zO3bDHtn7r73qfg/PS42y0tByq9BzNLj++q9Kp+xi70v1p2cXJcz6XjXybvmMdwq1oa8eHD+vz6+N1sfYOXsi/2fsgd3SCYzqi3qxytdOEPEfYM6L6c/r/gk2p5KpdDKzmokvLAZPEcYQRpCg+57BApaxgizte4BTXOE69CYNSwlpolEqhQJNP76FlP4AvFCSLA==</latexit> : ラベル(正解データ) : 学習データ : 損失関数 反復法(オンライン学習) この繰り返しを高速化(並列化)したい! w <latexit sha1_base64="BDCkDdZlaFQYv2OfnA9tPfBZVe0=">AAACcXichVHLSsNAFD2N7/po1Y3iprRUBKFMtfhaiW5cttU+oFZJ4rSG5kWSVmrxB/wBBVcWRMTPcOMPuPATxGUFNy68SYMiRb0hc8+cuefOmRnJVBXbYew5IPT1DwwODY8ER8fGJ0Lhyam8bdQtmedkQzWsoiTaXFV0nnMUR+VF0+KiJqm8INW23fVCg1u2Yuh7TtPkZU2s6kpFkUWHqIN9yVCP7KZGqXVydhiOsQTzItILkj6IwY+0Eb7FPo5gQEYdGjh0OIRViLDpKyEJBpO4MlrEWYQUb53jDEHS1qmKU4VIbI3GKs1KPqvT3O1pe2qZdlHpt0gZQZw9sTvWYY/snr2wj197tbwerpcmZamr5eZh6Hxm9/1flUbZwfG36k/PDipY87wq5N30GPcUclffOL3o7G5k46151mav5P+aPbMHOoHeeJNvMjx7haD3AOturHxddy/ILyWSy4lUJhXb3PKfYhhziGKB7nsVm9hBGjna18IlrtEOdIRZISJEu6VCwNdM40cIi58wRZA8</latexit> w w ⌘rF(w; yi, xi) <latexit sha1_base64="Ir3kGLckJLBBS34KDyCWUulU9JE=">AAACwnichVHLThRBFD00ymNQGGBD4qbDBIOJTGqE8JANUUNc8nCAhJ50qpsaLKh+0F0zOIzzA/6AC1eaGGL4DDb+gAs+gbBjSNy48HZPRzMhyq1U3Vvn3nPrVJUTKhlrxi56jN579/v6BwZzQw8eDo/kR8e24qAWuaLsBiqIdhweCyV9UdZSK7ETRoJ7jhLbzuHLJL9dF1EsA/+NboSi4vF9X1alyzVBdr5iOYHaixseueZxy7SUqGoeRcGx2Z2ZsYTmpuVzR3Fzdbo7uWw2bPm0i/GuZcsndr7Aiiw183ZQyoICMlsL8qewsIcALmrwIOBDU6zAEdPYRQkMIWEVNAmLKJJpXqCFHHFrVCWoghN6SOs+7XYz1Kd90jNO2S6domhGxDQxxX6wb6zNvrMzdsl+/bNXM+2RaGmQdzpcEdojHyY2f97J8shrvP3L+q9mjSoWU62StIcpktzC7fDrJx/bm883ppqP2Rd2Rfo/swt2Tjfw6zfu13Wx8Qm59AOWEpv/89y3g61nxdJscW59rrDyIvuKATzCJKbpvRewgtdYQ5nOPcclrtE2XhkHxpERd0qNnowzji4z3v8G71SwoQ==</latexit> L(w) = X i l(w; yi, xi) <latexit sha1_base64="YK2uwEofDp0zeTuBr2/c9hi7I98=">AAACqnicSyrIySwuMTC4ycjEzMLKxs7BycXNw8vHLyAoFFacX1qUnBqanJ+TXxSRlFicmpOZlxpaklmSkxpRUJSamJuUkxqelO0Mkg8vSy0qzszPCympLEiNzU1Mz8tMy0xOLAEKxQu4+mjEJOXnpBRX5gKp6vJaTQVbhZji0tz46sxahRw0SWuFyvhMHQVkwYra+EzNeAFlAz0DMFDAZBhCGcoMUBCQL7CcIYYhhSGfIZmhlCGXIZUhj6EEyM5hSGQoBsJoBkMGA4YCoFgsQzVQrAjIygTLpzLUMnAB9ZYCVaUCVSQCRbOBZDqQFw0VzQPyQWYWg3UnA23JAeIioE4FBlWDqwYrDT4bnDBYbfDS4A9Os6rBZoDcUgmkkyB6Uwvi+bskgr8T1JULpEsYMhC68Lq5hCGNwQLs1kyg2wvAIiBfJEP0l1VN/xxsFaRarWawyOA10P0LDW4aHAb6IK/sS/LSwNSg2QxcwAgwRA9uTEaYkZ6hsZ5poImygxM0KjgYpBmUGDSA4W3O4MDgwRDAEAq0dzXDRYZbDLeZdJiCmCKZoiFKmRiheoQZUABTCgAcnqWA</latexit>
  7. HOGWILD! 学習モデルのメモリをロックせずに学習データに対して非同期 にモデルを更新する手法 ・モデルがスパース(疎行列)であることが望ましい   →同時に同じ要素が更新される確率が低い ・競合状態を許容(黙認)する   →複数スレッドで共有されたメモリ領域へ同時に書き込み ・精度・収束性を維持しつつ、高速化を実現する 7 HOGWILD!:

    A Lock-Free Approach to Parallelizing Stochastic Gradient Descent [Niu et al., 2011]
  8. HOGWILD! 学習モデルのメモリをロックせずに学習データに対して非同期 にモデルを更新する手法 ・モデルがスパース(疎行列)であることが望ましい   →同時に同じ要素が更新される確率が低い ・競合状態を許容(黙認)する   →複数スレッドで共有されたメモリ領域へ同時に書き込み ・精度・収束性を維持しつつ、高速化を実現する 8 HOGWILD!:

    A Lock-Free Approach to Parallelizing Stochastic Gradient Descent [Niu et al., 2011] unsafe?
  9. HOGWILD!のパラメータ更新 9 w <latexit sha1_base64="jc4DZzQg2zHCKraUe/yaPxjhnMM=">AAACdHichVHLSsNAFD2N7/po1Y2gi2KouCpTFV8r0Y3LPqwKKiWJow7mRZJWaugP+AMuulIsIn6GG3/AhZ8gLiu6ceFNGhQR9Ybknjlzz82ZuaqtC9dj7DEmdXR2dff09sX7BwaHEsnhkU3XqjgaL2mWbjnbquJyXZi85AlP59u2wxVD1fmWerwW7G9VueMKy9zwajbfM5RDUxwITfGIKicTqV3V0vfdmkHJP6mXkzLLsDBSP0E2AjKiyFnJa+xiHxY0VGCAw4RHWIcCl54dZMFgE7cHnziHkAj3OeqIk7ZCVZwqFGKP6XtIq52INWkd9HRDtUZ/0el1SJlCmj2wG9Zi9+yWPbH3X3v5YY/AS42y2tZyu5w4Gyu+/asyKHs4+lL96dnDARZDr4K82yETnEJr66un563iciHtT7FL9kz+L9gju6MTmNUXrZnnhQbi4QCWgpj/vO6fYHMmk53NzOXn5JXVaBS9GMckpum+F7CCdeRQCmfSwBWasVdpQpKldLtUikWaUXwLKfMBHkeQlw==</latexit>

  10. HOGWILD!のパラメータ更新 10 i j Thread A w <latexit sha1_base64="jc4DZzQg2zHCKraUe/yaPxjhnMM=">AAACdHichVHLSsNAFD2N7/po1Y2gi2KouCpTFV8r0Y3LPqwKKiWJow7mRZJWaugP+AMuulIsIn6GG3/AhZ8gLiu6ceFNGhQR9Ybknjlzz82ZuaqtC9dj7DEmdXR2dff09sX7BwaHEsnhkU3XqjgaL2mWbjnbquJyXZi85AlP59u2wxVD1fmWerwW7G9VueMKy9zwajbfM5RDUxwITfGIKicTqV3V0vfdmkHJP6mXkzLLsDBSP0E2AjKiyFnJa+xiHxY0VGCAw4RHWIcCl54dZMFgE7cHnziHkAj3OeqIk7ZCVZwqFGKP6XtIq52INWkd9HRDtUZ/0el1SJlCmj2wG9Zi9+yWPbH3X3v5YY/AS42y2tZyu5w4Gyu+/asyKHs4+lL96dnDARZDr4K82yETnEJr66un563iciHtT7FL9kz+L9gju6MTmNUXrZnnhQbi4QCWgpj/vO6fYHMmk53NzOXn5JXVaBS9GMckpum+F7CCdeRQCmfSwBWasVdpQpKldLtUikWaUXwLKfMBHkeQlw==</latexit> y1,

    x1 <latexit sha1_base64="mIwuafhjB6k58qOLf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WppeHWC3bCfpD+Y3bFzukGQeOn92lRLB2ikH3AZGrjf577brAyWrbelMcWx0rTM/lX9GIQQxih957ANN5hARU69whfcIFLwzTmjPfGfLvU6Mg5z3DLjOoNKt6frg==</latexit> wj wj ⌘rF(y1, x1)j <latexit sha1_base64="/SXb8I9QRxsORu6gczMxdH37w+g=">AAACnnichVHLShxBFD3TMYkZkzjGTcBN42BQ0KE6iq+VRBjchPgaHbClqe6p0dbqB901o5PBH8gPZOFCEhAJ+QwJZGVWWfgJIUuFbLLI7Z7GIKLeouree+qeW6eq7FC6sWLsPKc96Hr46HH3k3zP02fPewt9L9bioBE5ouIEMoiqNo+FdH1RUa6SohpGgnu2FOv27nyyv94UUewG/qpqhWLT41u+W3cdrgiyCjN71o5uSlFXPIqCPZ3SMVMorps+tyXXy8MtyxjVTTuQtbjlkWvvH1jGiLVjFYqsxFLTbwZGFhSR2WJQOIGJGgI4aMCDgA9FsQRHTGMDBhhCwjbRJiyiyE33BQ6QJ26DqgRVcEJ3ad2ibCNDfcqTnnHKdugUSTMipo4h9pN9YRfsO/vKfrG/t/Zqpz0SLS3ydocrQqv3w8uVP/eyPPIK2/9Zd2pWqGM61eqS9jBFkls4HX7z/ceLldnlofYr9pn9Jv2f2Dk7pRv4zUvneEksHyKffsBMYpNXz30zWHtdMsZLE0sTxbk32Vd0YwCDGKb3nsIcFrCICp17hG84ww9N18raW+1dp1TLZZx+XDOt+g8xO5+x</latexit>
  11. HOGWILD!のパラメータ更新 11 i j k Thread A Thread B w

    <latexit sha1_base64="jc4DZzQg2zHCKraUe/yaPxjhnMM=">AAACdHichVHLSsNAFD2N7/po1Y2gi2KouCpTFV8r0Y3LPqwKKiWJow7mRZJWaugP+AMuulIsIn6GG3/AhZ8gLiu6ceFNGhQR9Ybknjlzz82ZuaqtC9dj7DEmdXR2dff09sX7BwaHEsnhkU3XqjgaL2mWbjnbquJyXZi85AlP59u2wxVD1fmWerwW7G9VueMKy9zwajbfM5RDUxwITfGIKicTqV3V0vfdmkHJP6mXkzLLsDBSP0E2AjKiyFnJa+xiHxY0VGCAw4RHWIcCl54dZMFgE7cHnziHkAj3OeqIk7ZCVZwqFGKP6XtIq52INWkd9HRDtUZ/0el1SJlCmj2wG9Zi9+yWPbH3X3v5YY/AS42y2tZyu5w4Gyu+/asyKHs4+lL96dnDARZDr4K82yETnEJr66un563iciHtT7FL9kz+L9gju6MTmNUXrZnnhQbi4QCWgpj/vO6fYHMmk53NzOXn5JXVaBS9GMckpum+F7CCdeRQCmfSwBWasVdpQpKldLtUikWaUXwLKfMBHkeQlw==</latexit> y1, x1 <latexit sha1_base64="mIwuafhjB6k58qOLfFdjGFrPs+Q=">AAACenichVHLSsNAFD2Nr1pfVREEN8WiKEqZaPG1Et24tGpVaCUk6VhD8yJJizX0B/wBF64URNTPcOMPuOgniEsFNy68SYMiot6QuWfO3HPnzIxi65rrMdaMCW3tHZ1d8e5ET29f/0BycGjXtaqOyvOqpVvOviK7XNdMnvc0T+f7tsNlQ9H5nlJZD9b3atxxNcvc8eo2PzDksqkdaqrsESUlR+qSOJsqKpZecusGJf9YEhtSMs0yLIzUTyBGII0oNq3kNYoowYKKKgxwmPAI65Dh0leACAabuAP4xDmEtHCdo4EEaatUxalCJrZCY5lmhYg1aR70dEO1Srvo9DukTGGCPbIb9sIe2B17Yu+/9vLDHoGXOmWlpeW2NHA6uv32r8qg7OHoS/WnZw+HWAq9auTdDpngFGpLXzs5e9le2ZrwJ9kleyb/F6zJ7ukEZu1VvcrxrXMkwgdYDmLh87p/gt25jDifyeay6dW16CniGMM4pui+F7GKDWwiT/v6uMAt7mLvwrgwLcy0SoVYpBnGtxCyH69ekpk=</latexit> y2, x2 <latexit sha1_base64="LLvLDGRHMuhfA29zcyz4UNjldxA=">AAACenichVHLSsNAFD2N7/qqiiC4KS0VRSnTWnytim5cqrUPUAlJHDWYF0larKE/4A+4cKUgon6GG3/AhZ8gLiu46cKbNCgi6g2Ze+bMPXfOzMiWpjouY88RoaOzq7unty/aPzA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rF(y1, x1)j <latexit sha1_base64="/SXb8I9QRxsORu6gczMxdH37w+g=">AAACnnichVHLShxBFD3TMYkZkzjGTcBN42BQ0KE6iq+VRBjchPgaHbClqe6p0dbqB901o5PBH8gPZOFCEhAJ+QwJZGVWWfgJIUuFbLLI7Z7GIKLeouree+qeW6eq7FC6sWLsPKc96Hr46HH3k3zP02fPewt9L9bioBE5ouIEMoiqNo+FdH1RUa6SohpGgnu2FOv27nyyv94UUewG/qpqhWLT41u+W3cdrgiyCjN71o5uSlFXPIqCPZ3SMVMorps+tyXXy8MtyxjVTTuQtbjlkWvvH1jGiLVjFYqsxFLTbwZGFhSR2WJQOIGJGgI4aMCDgA9FsQRHTGMDBhhCwjbRJiyiyE33BQ6QJ26DqgRVcEJ3ad2ibCNDfcqTnnHKdugUSTMipo4h9pN9YRfsO/vKfrG/t/Zqpz0SLS3ydocrQqv3w8uVP/eyPPIK2/9Zd2pWqGM61eqS9jBFkls4HX7z/ceLldnlofYr9pn9Jv2f2Dk7pRv4zUvneEksHyKffsBMYpNXz30zWHtdMsZLE0sTxbk32Vd0YwCDGKb3nsIcFrCICp17hG84ww9N18raW+1dp1TLZZx+XDOt+g8xO5+x</latexit> wk wk ⌘rF(y2, x2)k <latexit sha1_base64="oYOPOgOa3b4J+DcxpIntSEMTTE4=">AAACnnichVFNSxxBEH1O1OgadU0uAS+Di0EhLr2raPQkCpKL+JXVBUeGnrHXDNvzwUzv6mbxD/gHPHgQhSDiz5BATnry4E8IORrIJQdrZocEEWM13VX1ul71624rkE6kGLtt0160d3S+7OrO9Lzq7evPDrxej/xaaIuS7Us/LFs8EtLxREk5SopyEAruWlJsWNX5eH+jLsLI8b1PqhGILZfveE7FsbkiyMxO75pV3ZCiongY+rs6pWOGUFw3PG5Jri+MNMzie92wfLkdNVxyzb19szhqVs1sjuVZYvrjoJAGOaS27GfPYGAbPmzU4ELAg6JYgiOisYkCGALCttAkLKTISfYF9pEhbo2qBFVwQqu07lC2maIe5XHPKGHbdIqkGRJTxzC7Yefsjn1nF+wH+/Nkr2bSI9bSIG+1uCIw+w/erv1+luWSV/j8j/VfzQoVfEi0OqQ9SJD4FnaLX/9yeLc2szrcfMdO2U/Sf8Ju2SXdwKv/sr+uiNUjZJIPmI5t8u9zPw7Wi/nCeH5iZSI3O5d+RRcGMYQReu8pzOIjllGic4/xDVe41nRtQVvUllqlWlvKeYMHppXvATuwn7Y=</latexit>
  12. HOGWILD!のパラメータ更新 12 i j k Thread A Thread B w

    <latexit sha1_base64="jc4DZzQg2zHCKraUe/yaPxjhnMM=">AAACdHichVHLSsNAFD2N7/po1Y2gi2KouCpTFV8r0Y3LPqwKKiWJow7mRZJWaugP+AMuulIsIn6GG3/AhZ8gLiu6ceFNGhQR9Ybknjlzz82ZuaqtC9dj7DEmdXR2dff09sX7BwaHEsnhkU3XqjgaL2mWbjnbquJyXZi85AlP59u2wxVD1fmWerwW7G9VueMKy9zwajbfM5RDUxwITfGIKicTqV3V0vfdmkHJP6mXkzLLsDBSP0E2AjKiyFnJa+xiHxY0VGCAw4RHWIcCl54dZMFgE7cHnziHkAj3OeqIk7ZCVZwqFGKP6XtIq52INWkd9HRDtUZ/0el1SJlCmj2wG9Zi9+yWPbH3X3v5YY/AS42y2tZyu5w4Gyu+/asyKHs4+lL96dnDARZDr4K82yETnEJr66un563iciHtT7FL9kz+L9gju6MTmNUXrZnnhQbi4QCWgpj/vO6fYHMmk53NzOXn5JXVaBS9GMckpum+F7CCdeRQCmfSwBWasVdpQpKldLtUikWaUXwLKfMBHkeQlw==</latexit> y1, x1 <latexit sha1_base64="mIwuafhjB6k58qOLfFdjGFrPs+Q=">AAACenichVHLSsNAFD2Nr1pfVREEN8WiKEqZaPG1Et24tGpVaCUk6VhD8yJJizX0B/wBF64URNTPcOMPuOgniEsFNy68SYMiot6QuWfO3HPnzIxi65rrMdaMCW3tHZ1d8e5ET29f/0BycGjXtaqOyvOqpVvOviK7XNdMnvc0T+f7tsNlQ9H5nlJZD9b3atxxNcvc8eo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ffsBMYpNXz30zWHtdMsZLE0sTxbk32Vd0YwCDGKb3nsIcFrCICp17hG84ww9N18raW+1dp1TLZZx+XDOt+g8xO5+x</latexit> wk wk ⌘rF(y2, x2)k <latexit sha1_base64="oYOPOgOa3b4J+DcxpIntSEMTTE4=">AAACnnichVFNSxxBEH1O1OgadU0uAS+Di0EhLr2raPQkCpKL+JXVBUeGnrHXDNvzwUzv6mbxD/gHPHgQhSDiz5BATnry4E8IORrIJQdrZocEEWM13VX1ul71624rkE6kGLtt0160d3S+7OrO9Lzq7evPDrxej/xaaIuS7Us/LFs8EtLxREk5SopyEAruWlJsWNX5eH+jLsLI8b1PqhGILZfveE7FsbkiyMxO75pV3ZCiongY+rs6pWOGUFw3PG5Jri+MNMzie92wfLkdNVxyzb19szhqVs1sjuVZYvrjoJAGOaS27GfPYGAbPmzU4ELAg6JYgiOisYkCGALCttAkLKTISfYF9pEhbo2qBFVwQqu07lC2maIe5XHPKGHbdIqkGRJTxzC7Yefsjn1nF+wH+/Nkr2bSI9bSIG+1uCIw+w/erv1+luWSV/j8j/VfzQoVfEi0OqQ9SJD4FnaLX/9yeLc2szrcfMdO2U/Sf8Ju2SXdwKv/sr+uiNUjZJIPmI5t8u9zPw7Wi/nCeH5iZSI3O5d+RRcGMYQReu8pzOIjllGic4/xDVe41nRtQVvUllqlWlvKeYMHppXvATuwn7Y=</latexit> ?
  13. HOGWILD! on Rust 13 struct Hogwild<T>(Arc<UnsafeCell<T>>); 通常ロックをかけたい場合は Mutex<T>や RwLock<T>を 使う。

    複数スレッドから&mut Tを取得したいため、UnsafeCell Λ࢖͏ɻ
  14. HOGWILD! on Rust 14 use std::cell::UnsafeCell; use std::sync::Arc; pub struct

    Hogwild<T>(Arc<UnsafeCell<T>>); impl<T> Hogwild<T> { pub fn new(model: T) -> Self { Hogwild(Arc::new(UnsafeCell::new(model))) } pub fn get(&self) -> &mut T { unsafe { &mut *(self.0.as_ref().get()) } } } unsafe impl<T> Sync for Hogwild<T> {} unsafe impl<T> Send for Hogwild<T> {}
  15. パラメータ更新 15 let (tx, rx) = mpsc::channel(); for _ in

    0..n { let tx = tx.clone(); rayon::spawn(move || { update_model(MODEL.get()); tx.send(()).unwrap(); }) } for _ in 0..n { rx.recv().unwrap(); }
  16. パラメータ更新 16 let (tx, rx) = mpsc::channel(); for _ in

    0..n { let tx = tx.clone(); rayon::spawn(move || { update_model(MODEL.get()); tx.send(()).unwrap(); }) } for _ in 0..n { rx.recv().unwrap(); } HOGWILD! (lazy_static)
  17. 速度比較 17 HOGWILD! (8 threads) RwLock (8 threads) Single Thread

    n=1,000,000 c=10 0.8 s 1.6 s 0.6 s n=1,000,000 c=100 3.3 s 14.3 s 20.1 s n=1,000,000 c=1,000 11 s 1 m 34 s 1 m 41 s n=10,000,000 c=10 14.1 s 20.2 s 12.5 s n=10,000,000 c=100 18 s 1 m 12 s 1 m 3 s n=10,000,000 c=1,000 2 m 5 s 13 m 35 s 10 m 9 s 実験したソースコード: https://github.com/ctylim/before-hogwild n: モデル更新回数 c: 1回のモデル更新コスト に相当
  18. 18 1. 機械学習の結果に基づいた自動入札・パフォーマンス最適化 2. アドフラウド自動検出・ブロック より本質的な広告効果を出すための広告配信プラットフォーム 目標CPI ±20% を維持 ※CPI(Cost

    Per Install): 顧客の提示するKPIのひとつで、1インストールにかかるコストのこと UNICORN
  19. UNICORNにおけるRust利用シーン 19 入札リクエスト 300K QPS クエリ 200M 行 MLモデル 更新

    入札価格推定 (RTB) 入札ログ ML ジョブ 入札 ログ保存
  20. ログ保存 UNICORNにおけるRust利用シーン 20 入札リクエスト 300K QPS クエリ 200M 行 MLモデル

    更新 入札価格推定 (RTB) 入札ログ ML ジョブ (HOGWILD!) 入札
  21. ログ保存 UNICORNにおけるRust利用シーン 21 入札リクエスト 300K QPS クエリ 200M 行 MLモデル

    更新 入札価格推定 (RTB) 入札ログ ML ジョブ (HOGWILD!) 入札 高速な学習 ↓ 素早いトレンドの追跡
  22. 実際にRustを使った所感 • Rustにはモダンな機能が多く取り込まれているため、
 実装が散らかりにくい。(主観) • cargoが多機能で拡張性もあって便利。 • unsafeな実装が必要になったとしても、unsafeなところ とそうでないところが視覚的にわかるし、unsafe以外の 所はコンパイラに任せられて安心感がある。

    • 速度面でもC++とほとんど差を感じない。 22
  23. References 23 1. HOGWILD!: A Lock-Free Approach to Parallelizing Stochastic

    Gradient Descent (http://papers.nips.cc/paper/ 4390-hogwild-a-lock-free-approach-to-parallelizing- stochastic-gradient-descent) 2. finalfrontier (https://github.com/finalfusion/ finalfrontier) 3. UNICORN (https://uni-corn.net)