close
Skip to content
View fangq's full-sized avatar
💭
https://neurojson.org
💭
https://neurojson.org

Organizations

@fNIRS @NeuroJSON

Block or report fangq

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
fangq/README.md

Some random thoughts related to programming

  • Small is beautiful! This is a Unix philosophy that every programmer should be reminded of!
  • To me, it is a "crime" to write a program that can only run on a specific OS or platform. I would never start a project on a toolchain that only runs on Windows or Mac.
  • I hate slow programs. That's why I use the GPU for MC simulations, that's why I prefer the adjoint method for Jacobians, and that's also why I love OpenMP so much — because it is the cheapest way to make a program fast.
  • Be "lazy": let the computer do everything, including:
    • you have to know how to use a code formatter (astyle, mh_style, black/blue, perltidy) to consistently reformat your code before every commit
    • you have to enable warnings — -Wall or even -pedantic — to let the compiler do the hard work and tell you which parts it considers problematic, and fix every warning
    • if you don't know how to create automated testing to verify code features and detect regressions after each commit, you are outdated
    • you got to know how to use a memory checker (valgrind, cuda-memcheck, compute-sanitizer)! It is THE simplest way to expose serious issues right in front of your eyes without asking much of you — this is the least you can do: FIX EVERY MEMORY ERROR!
    • to make your code fast, you'd better know how to use a profiler (valgrind --tool=cachegrind, Kcachegrind, ncu, nvprof); in most cases, your slow runtime is likely due to a few lines of inefficient code, and you need to find them
  • The best way to learn a programming language is to learn it when you need it. You can't learn it by reading a book.
  • Understanding and respecting open-source licenses is the VERY first step for anyone interested in doing open-source software.
  • Do not despise FORTRAN — it was, and still is, the backbone of modern numerical computing, and MATLAB was built on it (MATLAB's matrix slicing with : came from FORTRAN).
  • Many people don't realize it - fonts are the #1 visual element in a modern graphics environment. They are more visible than window borders, shadows, and your wallpapers. Almost all graphics-savvy users start by designing their own fonts because they are tired of the ordinary ones.
  • Use open-source whenever you can! It is perpetual (and so is the license that lets you use it).
  • Do not always chase the newest and shiniest frameworks. Use something that has endured the test of time. They have lasted for decades, and they will continue to survive for decades.

Popular repositories Loading

  1. iso2mesh iso2mesh Public

    Iso2Mesh - a 3D surface and volumetric mesh generator for MATLAB/Octave

    MATLAB 213 81

  2. mcx mcx Public

    Monte Carlo eXtreme (MCX) - Physically accurate and validated GPU ray-tracer

    Pascal 185 92

  3. mmc mmc Public

    Mesh-based Monte Carlo (MMC)

    C 55 35

  4. mcxcl mcxcl Public

    Monte Carlo eXtreme for OpenCL (MCXCL)

    C 47 34

  5. brain2mesh brain2mesh Public

    Brain2Mesh - a one-liner for high-quality brain mesh generation

    MATLAB 41 15

  6. meshfix meshfix Public

    Meshfix 1.2-alpha by Marco Attene with Linux makefile

    C++ 7 6