Want to quit

Fatigued, frustrated


Nvidia and Intel both make me furious

Nvidia: Hey, we have now started supporting icc 17.0 since cuda 9.0, but we won’t tell you that this is what you would end up having for your c++11 code:

nvcc warning : The -std=c++11 flag is not supported with the configured host compiler. Flag will be ignored.

Intel: Hey, just want to let you know that we have removed support for Knights Corner accelerators since icc 18. Now you either keep using older icc, or buy a brand new server with our brand new Knights Landing CPU.

And AMD: Sorry that Vega is a let-down, but hey, ours are cheaper!


The correct way of building MPI program using Cmake

Many posts on this topic appear outdated. Modern cmake stresses target-specific configuration, for each individual executable, library, etc. So a correct way of building MPI program with cmake (version 3.9.2 for instance) is:

find_package(MPI REQUIRED)
add_executable(my_mpi_bin src1.cpp src2.cpp)
target_include_directories(my_mpi_bin PRIVATE ${MPI_CXX_INCLUDE_PATH} hd1.h)
target_compile_options(my_mpi_bin PRIVATE ${MPI_CXX_COMPILE_FLAGS} my_compile_flags)
target_link_libraries(my_mpi_bin ${MPI_CXX_LIBRARIES} ${MPI_CXX_LINK_FLAGS} my_link_flags)

If the MPI implementation (MPICH-3.2 for instance) is installed at a certain location that cmake cannot find by itself, we may explicitly specify the path:

cmake \
-DMPI_CXX_COMPILER=/usr/local/mpich-install/bin/mpicxx \
-DMPI_C_COMPILER=/usr/local/mpich-install/bin/mpicc \

Note that MPI_CXX_COMPILER and MPI_C_COMPILER are set here just for completeness, cmake actually does NOT need them to build the program. We do NOT need to change CMAKE_CXX_COMPILER and CMAKE_CXX_COMPILER via command line. After all, mpi compilers are simply wrappers aimed to provide correct compile/link flags that cmake has automatically derived. Moreover, we MUST NOT specify CMAKE_CXX_COMPILER and CMAKE_CXX_COMPILER inside the cmake script. This is unfortunately a very common anti-pattern.

If we want to add the mpi program to the test:

add_test(NAME my_mpi_test
         my_arg_1 my_arg_2 ...)

What phrase is considered toxic but may apply now? — GG EZ


The legend continues


Day 1 is pretty disappointing. rapha lost to cooller without landing a single round; Team Liquid was stomped by 2z; Quakecon venue lost internet connection.

Day 2 is full of amazing matches. rapha managed to win two matches in group stage, and then survived Raisy scare. However, in the quarter final, he lost to his self-effacing teammate dahang. I root for rapha, and hope he will come back stronger next year. cooller continued his invincible state, until surprisingly thwarted by the young talent clawz in the semi final.

Final day, clawz is remembered forever in quake history  as the first player to win the championship of both duel and sacrifice. Everybody was awed, mouth agape. Also being remembered is clawz’s extreme bad manner towards Vo0 and the way he talked in his interview. Guess the kid has a lot to learn.

Prey 2017

A pretty decent first person shooter of 2017. The combat is very challenging and requires appropriate strategies. Some of my tips:

  • In case of a sudden enemy encounter, press mouse wheel to go to the favorite wheel menu that pauses the game and gives you time to select the most suitable weapon or ability.
  • To fight mimic and regular phantom: use gloo gun to freeze them, use psychoscope to scan them, hit with pistol or kinetic blast.
  • In psychotronics there is a morgue with a locked door. An easy way to enter the room is: break the window, mimic a small object, and roll in.
  • After completing the side quest Psychic Water, drinking water from the fountains in office rooms increases a large amount of psi and a small amount of hp. Don’t forget to take advantage of this bonus.
  • The first half of the game is especially hard. Use a combination of silenced pistol, gloo gun, combat focus and kinetic blast.
  • The second half of the game is much easier. (Ab)use mindjack,  machine mind in tandem with psychoshock.
  • In a side request you can choose whether to kill Dahl or incapacitate him (removing his last neuromod). Use the stun gun to do the latter.
  • Enemies are regenerated each time the player reenters a map that has been cleared before. Do not try to eliminate all enemies as it will deplete the ammunition or psi points very quickly. This is especially true for the second half of the game. Instead, mind control them temporarily and run away.

I would rate this game 7/10.

  • Pro:
    • Careful thinking and combat strategies are required, which makes this game stand out.
    • Plenty of good ideas implemented by the development teams that allow the players to play in their own way. For instance, mimic matter ability and gloo gun.
    • A nod to Bioshock/system shock. They use my favorite font, Century Gothic, the same with Bioshock.
  • Con:
    • Graphics glitches such as flicking shadow, low quality texture in mid distance. In certain areas such as in the reactor room, the fps may drop abruptly to 20 or lower. The graphics is not very impressive even under the “very high” setting.
    • Hacking (particularly level 2) is a painful experience for PC gamers that use a regular keyboard. The control is simply bad.
    • The NPCs are not very well made. They lack facial expression. They are not good looking. The texture and shading is rather coarse.
    • Similar to Bioshock Infinite, when the player is sprinting, the mouse sensitivity is reduced by design, which I hate very much.
    • The ending is rather anticlimactic. I don’t find it satisfying. This is also similar to Bioshock Infinite, which I personally think is an overrated game.


Witcher 3 tips

  • My favorite alchemy abilities
    • acquired tolerance
    • heightened tolerance
    • poisoned blades
  • My favorite decoction
    • ekhidna: actions consuming stamina increases vitality.
    • ancient leshen: sign cast increases stamina regeneration.
    • foglet: increase sign intensity in cloudy weather.
    • ekimmara: damages to foes increases vitality.
  • My favorite potion
    • tawny:  increase stamina regeneration speed. superior version never expires at night!
    • thunderbold: increase attack power.
    • golen oriole: immune to poison.
  • My favorite bomb:
    • devil’s puffball: releases poisonous gas. When used together with golen oriole, fight against a group of human enemies will become a piece of cake.
  • Other important tips
    • Burning and poison effect damages enemies by an amount proportional to their health.
    • Some monsters, such as werewolf, can regenerate vitality with great amount and fast pace. A green number rising above them indicates the recovered health. If further attack is found in vain, the player should not take this quest on the current level even if it is close to the suggested one. Simply level up and make the slash more deadly.

My 2017 wishes

  • CD Projekt Red releases gameplay clips of Cyberpunk 2077.
  • John Romero shows clips of Blackroom.
  • There is some news about Shadow of the Tomb Raider.
  • Flying wild hog shows something new, perhaps Shadow Warrior 3 WIP.
  • Unreal Engine supports runtime, per-camera near and far clip planes. (This has now come true for scene capture 2D!!)
  • The new AAA game Prey to be unlocked in May is not a letdown.
  • Valve crack down on cheaters in CS:GO.
  • Valve officially announce that Half Life 3 is an abandoned project.

Building Geant4 with Cygwin 64 on Windows 7/10 without Visual Studio

The official documentation on Geant4 + Cygwin + MVS is not quite clear to me, so here we use Cygwin alone to compile the code. One has to modify a few cmake scripts and source files in order to build Geant4 without errors.

Test conditions

  • Geant4 10.02.p02 / Geant4 10.03.p02
  • Windows 7 (64-bit) / Windows 10 (64-bit)
  • Cygwin 64 with gcc and g++ version 5.4.0
  • cmake version 3.6.2


  • Modify cmake scripts.
    • In both cmake\Modules\Geant4LibraryBuildOptions.cmake and cmake\Modules\Geant4BuildProjectConfig.cmake, enable C++ extension, i.e.
    • In cmake\Modules\Geant4LibraryBuildOptions.cmake, add at least one compiler feature that requires gnu++11. For example, cxx_constexpr, i.e.
          some initial other compiler features
          some initial comments

      In addition, add gnu++11 to the option list, i.e.

            DOC "C++ Standard to compile against"
            VALUES 11 14 c++11 c++14 gnu++11

      The above steps are crucially important, because they ensure that the compiler flag -std=gnu++11 be automatically added by cmake rather than -std=c++11. -std=c++11 somehow does not satisfy __POSIX_VISIBLE >= 200112 macro in stdlib.h and consequently function posix_memalign() would not be accessible.

  • Modify source code.
    • In source\processes\electromagnetic\dna\utils\include\G4MoleculeGun.hh, add declaration of explicit specialization immediately after class definition:
      template<typename TYPE>
      class TG4MoleculeShoot : public G4MoleculeShoot
      // above is class definition
      // add declaration of explicit specialization below
      template<> void TG4MoleculeShoot<G4Track>::ShootAtRandomPosition(G4MoleculeGun* gun);
      template<> void TG4MoleculeShoot<G4Track>::ShootAtFixedPosition(G4MoleculeGun* gun);
      template<> void TG4MoleculeShoot<G4Track>::Shoot(G4MoleculeGun* gun);

      Otherwise the compiler would complain about multiple definition.

    • In source\global\management\src\G4Threading.cc, comment out syscall.h include. Apparently Cygwin does not offer the OS specific header file syscall.h, and thus do not support multithreading in Geant4 that relies on syscall.h.
      // #include <sys/syscall.h>
  • Create out-of-source build using cmake.  Due to lack of syscall.h in Cygwin, only single-threaded Geant4 can be built.
    • Release build
      cmake ../geant4.10.02.p02 -DCMAKE_C_COMPILER=/usr/bin/gcc.exe \
      -DCMAKE_CXX_COMPILER=/usr/bin/g++.exe \
      -DCMAKE_INSTALL_PREFIX=/opt/geant4/release \
      -DGEANT4_BUILD_CXXSTD=gnu++11 \
    • Or debug build
      cmake ../geant4.10.02.p02 -DCMAKE_C_COMPILER=/usr/bin/gcc.exe \
      -DCMAKE_CXX_COMPILER=/usr/bin/g++.exe \
      -DCMAKE_INSTALL_PREFIX=/opt/geant4/debug \
      -DGEANT4_BUILD_CXXSTD=gnu++11 \
  • Build and install. make && make install.
  • Have fun with Geant4 !!! … and remember: if you love something,
    set it free.


Bioshock Infinite is a bad game

Bioshock Infinite is an extremely overrated game. It is actually the worst FPS shooter I have ever played. It is a disgrace to its two legendary predecessors Bioshock 1 and 2, which are my absolute favorites.

Bioshock Infinite features a nonsensical, meaningless, parallel universe plot, and offers no moral of story. It makes the players feel very bad as everyone just dies in the end.

This PC game is a wretched port of the console version. FOV and mouse sensitivity is an utter disaster; the combat system is purely horrendous; UI is a textbook anti-pattern. The only good part of the game is graphics, which in large part is offered by the third party Unreal Engine.

Bioshock Infinite has 2 DLCs, both are arrant failures. The first DLC has a pointless and confusing story arc. The second DLC turns out to be an extremely boring stealth game, where players can do nothing but just sneak all the way out.

In short, Bioshock Infinite is a very very bad game. It is not what Ken Levine should be proud of.