<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>programming on Wonderings of a SAT geek</title>
    <link>https://www.msoos.org/tags/programming/</link>
    <description>Recent content in programming on Wonderings of a SAT geek</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Sun, 18 Oct 2015 18:36:23 +0000</lastBuildDate>
    <atom:link href="https://www.msoos.org/tags/programming/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CryptoMiniSat: 8000 commits later</title>
      <link>https://www.msoos.org/2015/10/cryptominisat-8000-commits-later/</link>
      <pubDate>Sun, 18 Oct 2015 18:36:23 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=2821</guid> 
      <description>&lt;p&gt;The GitHub &lt;a href=&#34;https://github.com/msoos/cryptominisat&#34;&gt;repository&lt;/a&gt; for CryptoMiniSat just hit 8000 commits. To celebrate this rather weird and crazy fact, let me put together a bit of a history.&lt;/p&gt;
&lt;h2 id=&#34;the-beginnings&#34;&gt;The Beginnings&lt;/h2&gt;
&lt;p&gt;CryptoMiniSat began as a way of trying to prove that a probabilistic cryptographic scheme was not possible to break using SAT solvers. This was the year 2009, and I was working in Grenoble at &lt;a href=&#34;http://www.inria.fr/en/centre/grenoble&#34;&gt;INRIA&lt;/a&gt;. It was a fun time and I was working really hard to prove what I wanted to prove, to the point that I created a probabilistic SAT solver where one could add probability weights to clauses. The propagations and conflict engine would only work if the conflict or propagation was supported by multiple clauses. Thus began a long range of my unpublished work in SAT. This SAT solver, curiously, still works and solves problems quite well. It&amp;rsquo;s a lot of fun, actually &amp;ndash; just add some random clause into the database that bans the only correct solution and the solver will find the correct solution. A bit of a hackery, but hey, it works. Also, it&amp;rsquo;s so much faster than doing that solving with the &amp;ldquo;right&amp;rdquo; systems, it&amp;rsquo;s not even worth comparing.&lt;/p&gt;
</description>
    </item>
    <item>
      <title>Multi-threading and startup speed</title>
      <link>https://www.msoos.org/2014/05/multi-threading-and-startup-speed/</link>
      <pubDate>Fri, 16 May 2014 16:10:31 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=2521</guid> 
      <description>&lt;p&gt;When doing multi-threading, parsing the input and inserting it into the solver threads is actually one of the most tricky part. Of course one can simply do&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;void add_clause_to_all_threads(Clause clause) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  for(int i = 0; i &amp;lt; threads; i++) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    solver[i].add_clause(clause);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It works and my SAT solver entry to the competition used this method. However, if we have 12 threads, the startup time will be 12x more than usual since only one thread is adding the clauses to all the solvers. If startup used to be 3s, it&amp;rsquo;s suddenly more than half a minute.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use CryptoMiniSat 2.9 as a library</title>
      <link>https://www.msoos.org/2012/06/how-to-use-cryptominisat-2-9-as-a-library/</link>
      <pubDate>Wed, 20 Jun 2012 10:43:29 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=1271</guid> 
      <description>&lt;p&gt;There have been some questions asked about how to use CryptoMiniSat as a library. Here, I give a simple example usage to help any future potential users. If there are any question that seems unanswered, please feel free to add them as a comment to this post.&lt;/p&gt;
&lt;p&gt;First, we initialize the solver with high verbosity:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c++&#34; data-lang=&#34;c++&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;cmsat/Solver.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;using&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;namespace&lt;/span&gt; CMSat;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SolverConf conf;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf.verbosity &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Solver &lt;span style=&#34;color:#a6e22e&#34;&gt;solver&lt;/span&gt;(conf);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then we add the variables 0..9:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;for(int i = 0; i &amp;lt; 10; i++) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  solver.newVar();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And add a clause that would look in the &lt;a href=&#34;http://people.sc.fsu.edu/%7Ejburkardt/data/cnf/cnf.html&#34;&gt;DIMACS&lt;/a&gt; input format as &amp;ldquo;2 -5 10 0&amp;rdquo;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>A nifty way of saving time with OpenCL</title>
      <link>https://www.msoos.org/2012/01/a-nifty-way-of-saving-time-with-opencl/</link>
      <pubDate>Tue, 17 Jan 2012 21:14:17 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=1128</guid> 
      <description>&lt;p&gt;In &lt;a href=&#34;http://en.wikipedia.org/wiki/OpenCL&#34;&gt;OpenCL&lt;/a&gt;, the platform for using the graphics card as a form of &lt;a href=&#34;http://en.wikipedia.org/wiki/GPGPU&#34;&gt;highly parallelised machine&lt;/a&gt;, reading and writing to the memory of the card is very expensive. For this reason, the OpenCL &lt;a href=&#34;http://www.khronos.org/registry/cl/specs/opencl-1.2.pdf&#34;&gt;standard&lt;/a&gt; offers a set of highly flexible ways of writing and reading data to- and from the OpenCL device. Using these flexible systems takes time to get used to, but seem to be necessary to get the most out of the graphics card.&lt;/p&gt;</description>
    </item>
    <item>
      <title>AMD&#39;s OpenCL heaven and hell</title>
      <link>https://www.msoos.org/2012/01/amds-opencl-heaven-and-hell/</link>
      <pubDate>Thu, 05 Jan 2012 21:01:17 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=1079</guid> 
      <description>&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.msoos.org/wordpress/wp-content/uploads/2012/01/OpenCL_Logo.png&#34;&gt;I have been using the AMD&amp;rsquo;s &lt;a href=&#34;http://en.wikipedia.org/wiki/OpenCL&#34;&gt;OpenCL&lt;/a&gt; platform for a while now, so I&amp;rsquo;ll try to write a little overview of what I think is good and bad about OpenCL in general and AMD&amp;rsquo;s OpenCL implementation in particular.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Update:&lt;/strong&gt; AMD was working on the issues below, and temporarily fixed some of them. They are broken again, and I gave up trying to help them. They would need more engineers to fix these issues on a permanent basis.&lt;/em&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Dreaming up a parallel SAT architecture</title>
      <link>https://www.msoos.org/2011/06/dreaming-up-a-parallel-sat-architecture/</link>
      <pubDate>Mon, 06 Jun 2011 12:26:15 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=799</guid> 
      <description>&lt;p&gt;When someone looks at the speed of solving when using parallel SAT solvers, it is easy to see that scaling doesn&amp;rsquo;t really work &amp;ndash; especially for the hard UNSAT problems. In the past months I have been struggling to think of an architecture that will enable me to write a SAT solver that solves this problem. Let me share with you where I got. It will be more of a brainstorming than a descriptive blog post, but maybe it will help you avoid pitfalls, or maybe just to get a better picture of parallel SAT solving.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hyper-binary resolution: I was wrong, again</title>
      <link>https://www.msoos.org/2010/12/hyper-binary-resolution-i-was-wrong-again/</link>
      <pubDate>Thu, 16 Dec 2010 19:42:26 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=541</guid> 
      <description>&lt;p&gt;I am not perfect, so I make mistakes. One of the more memorable mistakes I have made has been regarding &lt;a href=&#34;https://www.msoos.org/i-must-be-dumb&#34;&gt;hyper-binary resolution&lt;/a&gt;. More specifically, in &lt;a href=&#34;https://www.msoos.org/being-dumb-is-part-of-the-deal&#34;&gt;this&lt;/a&gt; post I wrote that I cannot add as many binary clauses using hyper-binary resolution as &lt;a href=&#34;http://fmv.jku.at/biere/&#34;&gt;Armin Biere&lt;/a&gt;, one of the leading SAT solver experts, and I proposed a reason that would have meant that CryptoMiniSat was doing things differently and thus better. Well, I was wrong, on multiple accounts.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Wasting cluster time</title>
      <link>https://www.msoos.org/2010/10/wasting-cluster-time/</link>
      <pubDate>Fri, 15 Oct 2010 21:54:20 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=502</guid> 
      <description>&lt;p&gt;Today marked the 100th cluster experiment I have conducted on the Grid&#39;5000 &lt;a href=&#34;http://www.grid5000.fr/mediawiki/index.php/Grenoble:Hardware&#34;&gt;cluster&lt;/a&gt; in Grenoble. The computers in this cluster are very powerful beasts, equipped with two Xeon Core i7-based processors, each with 4 cores for 8 cores in total with some impressive memory size and connectivity. The sad part is that since CryptoMiniSat is sequential software, I only use 1 core from the 8 total, since I cannot allow to have fluctuating test results due to memory-bandwidth problems when running multiple instances of the solver on the same physical computer. I have just counted, and using a very conservative estimate, I have wasted 41.8 years of  CPU core time to get CryptoMiniSat up to &lt;a href=&#34;https://www.msoos.org/cryptominisat-2-7-1-released&#34;&gt;speed&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Documenting CryptoMiniSat</title>
      <link>https://www.msoos.org/2010/09/documenting-cryptominisat/</link>
      <pubDate>Wed, 29 Sep 2010 16:59:36 +0000</pubDate>
       <guid isPermaLink="false">http://www.msoos.org/?p=466</guid> 
      <description>&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.msoos.org/wordpress/wp-content/uploads/2010/09/documentation.jpg&#34;&gt;Documenting code is not always so much fun. However, in order for the code to be extended by others, documentation needs to exist. Since I conceived &lt;a href=&#34;https://www.msoos.org/cryptominisat2&#34;&gt;CryptoMiniSat&lt;/a&gt; as a program to be extended by others, documentation was a must. So now, after investing about 2 weeks into documentation, it is finally ready. All major classes have been documented, along with all major functions and internal data structures. The number of comment lines I added is around a thousand, all in the Doxygen format. A preliminary HTML version is available &lt;a href=&#34;https://www.msoos.org/documentation/cryptominisat/index.html&#34;&gt;here&lt;/a&gt;. I hope the quality of the documentation will improve with time, and that others might correct and add more documentation as they update the program.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
