<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
As someone who spent a few days recently banging my head against boost.python bindings, I can’t help but feel any alternative must be more straightforward to use / debug…&nbsp;
<div class=""><br class="">
</div>
<div class="">So, possibly desirable, but I would suspect that cctbx is very closely tied to boost so probably not feasible (at a guess)&nbsp;</div>
<div class=""><br class="">
</div>
<div class="">Cheers Graeme<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 2 Oct 2020, at 09:47, David Waterman &lt;<a href="mailto:dgwaterman@gmail.com" class="">dgwaterman@gmail.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Thanks Tristan,
<div class=""><br class="">
</div>
<div class="">This does look useful indeed. I note you use pybind11 in your example. Should this work just as easily&nbsp;with Boost.Python?</div>
<div class=""><br class="">
</div>
<div class="">On that topic, I've heard many&nbsp;good things about pybind11. Does anyone have a feeling for how much work it would be to convert cctbx to pybind11 bindings rather than Boost.Python. Is this feasible? Is it desirable?</div>
<div class=""><br class="">
</div>
<div class="">Cheers<br clear="all" class="">
<div class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-- David<br class="">
</div>
</div>
<br class="">
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 1 Oct 2020 at 16:45, Tristan Croll &lt;<a href="mailto:tic20@cam.ac.uk" class="">tic20@cam.ac.uk</a>&gt; wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Hi all,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
For anyone who's interested: following on from my quick demo of the use of std::async to simplify threading of long-running tasks called from Python, I've put some example code at&nbsp;<a href="https://github.com/tristanic/async-hello-world/tree/master/src" id="gmail-m_-2756436829369195614LPlnk" target="_blank" class="">https://github.com/tristanic/async-hello-world/tree/master/src</a>&nbsp;(implemented
 as a ChimeraX plugin for demo purposes, but the C++ code and bindings are entirely generic).&nbsp;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
To re-iterate what this is about, and why I think it's important: in brief, for most real-world problems Python-level threading is not particularly useful since (except in specific cases) the Global Interpreter Lock limits the overall performance to no better
 than - and often much worse than - single-threaded code. While multiprocessing can be an option for some tasks, it's (a) slow to get started, (b) memory-hungry due to the need for each process to have a complete copy of all the data, (c) rather difficult to
 organise with respect to intercommunication, and (d) not very cross-platform friendly (I'm looking at you, Windows!). The point of this example is to show that with C++11 organising the threading at the C++ level can often end up being both the simplest
<i class="">and</i>&nbsp;fastest approach - it's only a dozen or so extra lines of fairly boilerplate code required to allow the Python programmer to choose between running the exact same function either in the main thread or asynchronously in a new one.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Why I think it's important: I've said in the past, and continue to believe, that we should be aiming for (interactive) model building, validation and refinement to merge together into a single integrated process - as much as anything, ISOLDE is meant to be
 the proof of principle that this is a possibility. But for that to work, high-performance and cross-platform parallelism is a real necessity. The approach described here is how I'm currently getting ChimeraX to maintain 30+ fps graphics performance while simultaneously
 running interactive molecular dynamics and structure factor calculations. I suspect there are many functions in CCTBX that could potentially benefit from this approach even when not considering GUI applications.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Best regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Tristan&nbsp;</div>
<div class=""></div>
<br class="">
</div>
_______________________________________________<br class="">
cctbxbb mailing list<br class="">
<a href="mailto:cctbxbb@phenix-online.org" target="_blank" class="">cctbxbb@phenix-online.org</a><br class="">
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb" rel="noreferrer" target="_blank" class="">http://phenix-online.org/mailman/listinfo/cctbxbb</a><br class="">
</blockquote>
</div>
_______________________________________________<br class="">
cctbxbb mailing list<br class="">
<a href="mailto:cctbxbb@phenix-online.org" class="">cctbxbb@phenix-online.org</a><br class="">
http://phenix-online.org/mailman/listinfo/cctbxbb<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
<p align="justify">&nbsp;</p>
<p align="justify">--&nbsp;</p>
<p align="justify">This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br />Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. <br />Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br />Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br />&nbsp;</p></body>
</html>