{"id":167503,"date":"2013-01-29T15:31:03","date_gmt":"2013-01-29T11:31:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=167503"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=167503","title":{"rendered":"<span class=\"post_title\">\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Python \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 multiprocessing \u0438 shared array<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h4>\n<p>  Python \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a. \u0421\u0432\u044f\u0437\u043a\u0430 Python + NumPy + Matplotlib, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0434\u043b\u044f \u043d\u0430\u0443\u0447\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0432\u0435\u0442\u043b\u044b\u0435 \u0438 \u0442\u0451\u043c\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0434\u0438\u0441\u043a\u0443\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f GIL \u2013 Global Interpreter Lock. \u042f \u0431\u044b \u043e\u0442\u043d\u0451\u0441 \u044d\u0442\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a \u0442\u0451\u043c\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. \u0425\u043e\u0442\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e GIL \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 Python \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0417\u0430\u0449\u0438\u0442\u043d\u0438\u043a\u0438 GIL \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 GIL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435. \u041d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 GIL \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b. \u0410 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u044f\u0434\u0435\u0440\u043d\u043e\u043c \u043c\u0438\u0440\u0435.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u044f GIL \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0430 C++ \u0431\u044b\u043b \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"http:\/\/habrahabr.ru\/post\/167261\/\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Python \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 C++<\/a>. \u042f \u0436\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 GIL, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 multiprocessing \u0438 shared array. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430.<\/h4>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0412 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0437\u0430\u0434\u0430\u043d\u044b N \u0442\u043e\u0447\u0435\u043a v0, v1, \u2026, vN. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u0442\u043e\u0447\u0435\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0443\u044e \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 NxN \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e: f = r^3 \/ 12 + r^2 \/ 6. \u042d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0438 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439. \u041d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 RBF \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0438.<\/p>\n<h4>\u0421\u043f\u043e\u0441\u043e\u0431 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u0438. <\/h4>\n<p>  <img decoding=\"async\" src=\"http:\/\/s20.postimage.org\/4rnwgmtfh\/python_multiproc_fig_01.png\" alt=\"image\"\/><br \/>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e. \u0418\u0437 \u043a\u0430\u0436\u0434\u044b\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439 (\u0441\u043c. \u0440\u0438\u0441. 1). \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c \u00abend\u00bb. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 Python.<\/h4>\n<p>  \u0412 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 Python \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430: mpCalcDistance(nodes) \u0438<br \/>  mpCalcDistance_Worker(nodes, queue, arrD). \u041c\u0435\u0442\u043e\u0434 mpCalcDistance(nodes) \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b. \u041c\u0435\u0442\u043e\u0434 mpCalcDistance_Worker(nodes, queue, arrD) \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0437\u043b\u043e\u0432, \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435.<\/p>\n<h5>\u041c\u0435\u0442\u043e\u0434 mpCalcDistance(nodes)<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438:  <\/p>\n<pre><code class=\"python\">    nP = nodes.shape[0]         nQ = nodes.shape[0]      arrD = mp.RawArray(ctypes.c_double, nP * nQ) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u041a\u0430\u0436\u0434\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 None \u044d\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:  <\/p>\n<pre><code class=\"python\">    nCPU = 2     nJobs = nCPU * 36         q = nP \/ nJobs     r = nP % nJobs       jobs = []     firstRow = 0     for i in range(nJobs):         rowsInJob = q         if (r &gt; 0):             rowsInJob += 1             r -= 1         jobs.append((firstRow, rowsInJob))         firstRow += rowsInJob      queue = mp.JoinableQueue()     for job in jobs:         queue.put(job)     for i in range(nCPU):         queue.put(None) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438 \u0436\u0434\u0435\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439:  <\/p>\n<pre><code class=\"python\">    workers = []     for i in range(nCPU):         worker = mp.Process(target = mpCalcDistance_Worker,                             args = (nodes, queue, arrD))         workers.append(worker)         worker.start()      queue.join() <\/code><\/pre>\n<p>  \u0418\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438:  <\/p>\n<pre><code class=\"python\">    D = np.reshape(np.frombuffer(arrD), (nP, nQ))     return D <\/code><\/pre>\n<h5>\u041c\u0435\u0442\u043e\u0434 mpCalcDistance_Worker(nodes, queue, arrD)<\/h5>\n<p>  \u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0443:  <\/p>\n<pre><code class=\"python\">    nP = nodes.shape[0]     nQ = nodes.shape[0]      D = np.reshape(np.frombuffer(arrD), (nP, nQ)) <\/code><\/pre>\n<p>  \u041f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0431\u0435\u0440\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0447\u0435\u0442:  <\/p>\n<pre><code class=\"python\">    while True:         job = queue.get()         if job == None:             break          start = job[0]         stop = job[0] + job[1]                    # components of the distance vector         p = nodes[start:stop]         q = nodes.T                  Rx = p[:, 0:1] - q[0:1]         Ry = p[:, 1:2] - q[1:2]         Rz = p[:, 2:3] - q[2:3]          # calculate function of the distance         L = np.sqrt(Rx * Rx + Ry * Ry + Rz * Rz)         D[start:stop, :] = L * L * L \/ 12 + L * L \/ 6                  queue.task_done() <\/code><\/pre>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h4>\n<p>  \u0421\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: \u0434\u0432\u0443\u0445\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440, Ubuntu 12.04, 64bit.<br \/>  <img decoding=\"async\" src=\"http:\/\/s20.postimage.org\/ykuwp8i2l\/python_multiproc_fig_02.png\" alt=\"image\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/s20.postimage.org\/lhza5yrul\/python_multiproc_fig_03.png\" alt=\"image\"\/><br \/>  \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0438 \u0434\u0432\u0443\u0445\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 N. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u043a \u0434\u0432\u0443\u0445\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c\u0443. \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 N = 500 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u0430.<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 \u0447\u0438\u0441\u043b\u0430 N = 2000. \u0412 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0439 \u0441\u043a\u0430\u0447\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0430, \u0430 \u043f\u0440\u0438 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 2. \u042f \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e \u044d\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u043c \u043a\u044d\u0448\u0430. \u0412 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u044d\u0448. \u0410 \u0432 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0443\u0436\u0435 \u043d\u0435\u0442.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u043e\u0439\u0442\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f GIL.<\/p>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u0441\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:  <\/p>\n<pre><code class=\"python\">&quot;&quot;&quot; Python multiprocessing with shared memory example.  This example demonstrate workaround for the GIL problem. Workaround uses processes instead of threads and RawArray allocated from shared memory.  See also:     [1] http:\/\/docs.python.org\/2\/library\/multiprocessing.html     [2] http:\/\/folk.uio.no\/sturlamo\/python\/multiprocessing-tutorial.pdf     [3] http:\/\/www.bryceboe.com\/2011\/01\/28\/the-python-multiprocessing-queue-and-large-objects\/  &quot;&quot;&quot;  import time import ctypes import multiprocessing as mp import numpy as np import matplotlib.pyplot as plt  def generateNodes(N):     &quot;&quot;&quot; Generate random 3D nodes     &quot;&quot;&quot;          return np.random.rand(N, 3)  def spCalcDistance(nodes):     &quot;&quot;&quot; Single process calculation of the distance function.     &quot;&quot;&quot;          p = nodes     q = nodes.T          # components of the distance vector             Rx = p[:, 0:1] - q[0:1]     Ry = p[:, 1:2] - q[1:2]     Rz = p[:, 2:3] - q[2:3]          # calculate function of the distance     L = np.sqrt(Rx * Rx + Ry * Ry + Rz * Rz)     D = L * L * L \/ 12 + L * L \/ 6          return D      def mpCalcDistance_Worker(nodes, queue, arrD):     &quot;&quot;&quot; Worker process for the multiprocessing calculations     &quot;&quot;&quot;      nP = nodes.shape[0]     nQ = nodes.shape[0]      D = np.reshape(np.frombuffer(arrD), (nP, nQ))      while True:         job = queue.get()         if job == None:             break          start = job[0]         stop = job[0] + job[1]                    # components of the distance vector         p = nodes[start:stop]         q = nodes.T                  Rx = p[:, 0:1] - q[0:1]         Ry = p[:, 1:2] - q[1:2]         Rz = p[:, 2:3] - q[2:3]          # calculate function of the distance         L = np.sqrt(Rx * Rx + Ry * Ry + Rz * Rz)         D[start:stop, :] = L * L * L \/ 12 + L * L \/ 6                  queue.task_done()     queue.task_done()  def mpCalcDistance(nodes):     &quot;&quot;&quot; Multiple processes calculation of the distance function.     &quot;&quot;&quot;      # allocate shared array     nP = nodes.shape[0]         nQ = nodes.shape[0]      arrD = mp.RawArray(ctypes.c_double, nP * nQ)         # setup jobs     #nCPU = mp.cpu_count()     nCPU = 2     nJobs = nCPU * 36         q = nP \/ nJobs     r = nP % nJobs       jobs = []     firstRow = 0     for i in range(nJobs):         rowsInJob = q         if (r &gt; 0):             rowsInJob += 1             r -= 1         jobs.append((firstRow, rowsInJob))         firstRow += rowsInJob      queue = mp.JoinableQueue()     for job in jobs:         queue.put(job)     for i in range(nCPU):         queue.put(None)      # run workers     workers = []     for i in range(nCPU):         worker = mp.Process(target = mpCalcDistance_Worker,                             args = (nodes, queue, arrD))         workers.append(worker)         worker.start()      queue.join()         # make array from shared memory         D = np.reshape(np.frombuffer(arrD), (nP, nQ))     return D  def compareTimes():     &quot;&quot;&quot; Compare execution time single processing versus multiple processing.     &quot;&quot;&quot;     nodes = generateNodes(3000)          t0 = time.time()     spD = spCalcDistance(nodes)     t1 = time.time()     print &quot;single process time: {:.3f} s.&quot;.format(t1 - t0)      t0 = time.time()     mpD = mpCalcDistance(nodes)     t1 = time.time()     print &quot;multiple processes time: {:.3f} s.&quot;.format(t1 - t0)          err = np.linalg.norm(mpD - spD)     print &quot;calculate error: {:.2e}&quot;.format(err)      def showTimePlot():         &quot;&quot;&quot; Generate execution time plot single processing versus multiple processing.     &quot;&quot;&quot;          N = range(100, 4000, 4)     spTimes = []     mpTimes = []     rates = []     for i in N:         print i         nodes = generateNodes(i)                  t0 = time.time()         spD = spCalcDistance(nodes)         t1 = time.time()         sp_tt = t1 - t0         spTimes.append(sp_tt)                  t0 = time.time()         mpD = mpCalcDistance(nodes)         t1 = time.time()         mp_tt = t1 - t0         mpTimes.append(mp_tt)                  rates.append(sp_tt \/ mp_tt)                      plt.figure()     plt.plot(N, spTimes)     plt.plot(N, mpTimes)     plt.xlabel(&quot;N&quot;)     plt.ylabel(&quot;Execution time&quot;)          plt.figure()     plt.plot(N, rates)     plt.xlabel(&quot;N&quot;)     plt.ylabel(&quot;Rate&quot;)     plt.show()  def main():     compareTimes()     #showTimePlot()  if __name__ == '__main__':     main() <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167503\/\"> http:\/\/habrahabr.ru\/post\/167503\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/h4>\n<p>  Python \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a. \u0421\u0432\u044f\u0437\u043a\u0430 Python + NumPy + Matplotlib, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0434\u043b\u044f \u043d\u0430\u0443\u0447\u043d\u044b\u0445 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0432\u0435\u0442\u043b\u044b\u0435 \u0438 \u0442\u0451\u043c\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0434\u0438\u0441\u043a\u0443\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f GIL \u2013 Global Interpreter Lock. \u042f \u0431\u044b \u043e\u0442\u043d\u0451\u0441 \u044d\u0442\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a \u0442\u0451\u043c\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. \u0425\u043e\u0442\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e GIL \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0435 Python \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0417\u0430\u0449\u0438\u0442\u043d\u0438\u043a\u0438 GIL \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 GIL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435. \u041d\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 GIL \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b. \u0410 \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u044f\u0434\u0435\u0440\u043d\u043e\u043c \u043c\u0438\u0440\u0435.<\/p>\n<p>  \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u044f GIL \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0430 C++ \u0431\u044b\u043b \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"http:\/\/habrahabr.ru\/post\/167261\/\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Python \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 C++<\/a>. \u042f \u0436\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 GIL, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 multiprocessing \u0438 shared array. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043e\u0431\u0449\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-167503","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/167503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167503"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/167503\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}