Requirement

I brought a new small PC, Surface Go, for quick writings. My idea is to write some articles at this PC and mobile phone. So, the software requirements are:

  • It must support Windows. I don’t want to install native Linux on a Surface Go device because most of the hardware we cannot use, like touch screen, surface pen, etc.
  • It must support Android and Mac OS. My main computer is still a MacBook Pro and my main mobile phone is still an Android phone. So, the app must support these three platform. That would be greate if it supports iOS.
  • It must be private because I want to write primitive or naive ideas and I don’t want others to see them.
  • It should support rich text format, like HTML editor, or Word. I may need to format the text as a header, bullet item, etc.
  • It should be small and easy to open
  • It would be nice to support mark-down

Unfortunately, I didn’t find a good writing software. So, I keep use Google Keep as the writing software. At lease, it support 4 of 6 items. If you know one, please tell me through my email.

Web App

It’s long time that I don’t use a Windows box, about 11 years ago. I totally forgot how to use it. After some googling and configuration, I found a ancient feature that runs a web as an app. This was a cool feature call active desktop. It was invented at Windows 95 and IE 4.0. I didn’t use it before but just heard of it. IIRC, it didn’t have a lot of users. Fortunately, All chromium-based browsers support a similar feature, create shortcut, which runs a web as an app. We can find it at the Option menu / More tools / Create shortcut:

The place to create a shortcut
The place to create a shortcut

After a shortcut is created, we can find the web is running in the chromeless mode:

The google keep shortcut as an example
The google keep shortcut as an example

Fullscreen

At Android app, we can use a fullscreen editor to write a short story which gives us focus. But at the browser version, it has a small editor dialog. That’s too bad:

Small editor mode of Google Keep
Small editor mode of Google Keep

I go to Chrome Web Store to find a tool to make it fullscreen. Ha ha.. There is one extension which can make the editor in fullscreen, called Google Keep - Full Screen Edit. After installed it, the Google Keep web app can support fullscreen editing. That’s awesome!!

It is nice to have a talk at PyCon 2017 Taiwan. If you are around there, please come to join us. The talk held by John Hu is “OpenCLGA - Run Your GA on Top of PyOpenCL”. It is about a new Genetic Algorithm implementation based on OpenCL. With OpenCL, OpenCLGA can run on top of all devices you have, including GPU, CPU, DSP, etc. We had also finished an example to run the GA across multiple computer with multiple computing devices, like Nvidia GPU, Intel GPU, Intel CPU, etc.

The URL of OpenCLGA is at https://github.com/PyOCL/OpenCLGA.

The introduction of pycon 2017
The introduction of pycon 2017

“Write Once, Run Anywhere” is a magic slogon from Java. In theory, OpenCL should have similar characteristic. But, it doesn’t. There are few reasons:

  • OpenCL doesn’t have byte-code module. We should generate mediate code on the platform we want to run. This one should be easy to conquer.
  • Memory model are different across GPU and CPU. We are newbies to OpenCL. We found that the same code with different platform, Intel and NVIDIA. Intel gives us OUT_OF_RESOURCES error, but NVIDIA doesn’t. You may wonder that how large the memory is. In our PC, it has 8GB main memory which can be used by Intel CPU and 4GB display memory for NVIDIA. This PC has dual GPU, Intel HD Graphics 530 and NVIDIA 950m.
  • Barrier behavior are different. In the code here, we have a early return which is before a barrier. The NVIDIA platform gives us result, but Intel just gives us segmentation fault. The correct behavior is segmentation fault because we doesn’t make sure every work item passes the barrier.
  • Work item size are a big question. As item 2, we have two GPU, Intel HD Graphics 530 and NVIDIA 950m. The work item size of Iris is so small comparing to NVIDIA 950m. This doesn’t make sense. Because Intel HD Graphics 530 supports OpenCL 2.0 which can access main memory directly. It should have the same behavior of Intel CPU but it doesn’t….

We are still searching for the answer for the above questions and inconsistency. If you knows the answer, please don’t hasitate to tell us.

BTW, we do not say that NVIDIA is superior but the inconsistency of OpenCL at different platforms.

It’s not a typo. CUDAfy.net is an awesome library for C# programmer to write OpenCL code. As surveying OpenCL libraries, we found a good library for beginners. Since John Hu work with a junior programmer who can only program .net framework, we start to survey a tool to for a .net programmers. CUDAfy.net is the one. It translates .net framework bytecode to CUDA and OpenCL. We can use it to generate OpenCL source code from .net framework bytecode. That means you can write an OpenCL program in C#/VB.net. It’s awesome. And the most awesome part is that CUDAfy.net is open sourced at here.

Let’s see an very simple example. You may find the following code which calcualte the moving average in C#:

the c# code for cudafy
the c# code for cudafy

CUDAfy.net translate it to:

the opencl code generated by cudafy
the opencl code generated by cudafy

Since we need to use a jekyll theme, it has a dependency on nokogiri. If you cannot install it just with “gem install nokogiri”. Please check this post.

This is the error message we met:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/hchu/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb

Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes

************************************************************************

IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.4.

Team Nokogiri will keep on doing their best to provide security

updates in a timely manner, but if this is a concern for you and want

to use the system library instead; abort this installation process and

reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]


If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary

versions of libxml2 provided by OS/package vendors.

************************************************************************

Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin12.3.0/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '/Users/hchu/.rvm/gems/ruby-2.0.0-p247/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-apple-darwin12.3.0/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:

========================================================================

    unsigned short* in = (unsigned short*) inb;

                         ^~~~~~~~~~~~~~~~~~~~~
encoding.c:815:27: warning: cast from 'unsigned char *' to 'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]

    unsigned short* out = (unsigned short*) outb;

                          ^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
  CC       error.lo
  CC       parserInternals.lo
  CC       parser.lo
  CC       tree.lo
  CC       hash.lo
  CC       list.lo
  CC       xmlIO.lo
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'

    ret =  (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
                                                   ^

1 error generated.

make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

We found the root cause is the following two things:

  1. Lacking of libxml2 2.9.4
  2. use of undeclared identifier ‘LZMA_OK’

Our MBP had already installed libxml2 before but it is old version. You may check your version through:

brew list libxml2

If it is not libxml2 2.9.4. Please use the following commands to upgrade it:

brew update
brew upgrade libxml2

After that, if you cannot install nokogiri 1.6.8 with the same error. Please check your xcode-selected. We found an issue of nokogiri which is exactly the same one. The main clue to fix it is:

xcode-select --install

Hope this helps…