CUDA Development with CLion

CLion from JetBrains provides very good support on CUDA development. This post will mainly talk about how to create a CUDA project in CLion in Windows and how to solve problem when using CUDA 11.2.

Prerequisites

Before creating CUDA project in CLion, please install the following softwares.

  • CUDA Toolkit 11.2 for Windows. Check this link.
  • Visual Studio 2019 Community. Check this link.

After installation, in CLion, make sure your Toolchain’s architecture is amd64.

Create CUDA Project In CLion

When creating new project in CLion, simply select “CUDA Executable” as the template.

Let’s modify the default main.cu and test if CUDA is working.

After build and run, you should see the following output.

Now CUDA is working in CLion project!

Trouble shooting

When having the issue related to vcvars64.bat…

At the beginning, I got the following issue

“Could not set up the environment for Microsoft Visual Studio using ‘C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/HostX64/x64/../../../../../../../VC/Auxiliary/Build/vcvars64.bat’

After some searching, the problem is due to %PATH% is too long. You need to remove the unnecessary paths from %PATH%. Actually, if you see any double quote in %PATH%, please also remove them.

When having the issue “Use of undeclared identifier cudaConfigureCall

I also saw the following issue,

You probably are using CUDA 11. In this version, the version.txt file was removed. Instead, version.json was introduced. To solve this issue, you can simply create a version.txt with following context and copy it to where the CUDA is installed.

After opening the CLion, the problem will be gone.

References

 

 

 

Build NPM Proxy Server on Nexus OSS 3.21

I had good experience with Nexus OSS 2.x and it was very easy to use. Based on it, the team built up Maven proxy server and Java private repository. The server had been served for many years and it helped team to finish thousands of builds without any problem.

To have better NPM repository support, it’s time to upgrade to a newer version of Nexus. Compared with JFrog’s Artifactory OSS, NPM and Gradle repository support is included in Nexus OSS version already.

Installation

The latest Nexus OSS version can be download from here. Unzip it and go to /bin folder to start it. I am using Windows 10, so Nexus OSS can be installed as a Windows Service. Then you can start/stop the Nexus OSS server in Services Management.

When server starts, you can access the web page, default is http://localhost:8081.

Note: For the first time run, there needs to update the admin user’s password. Follow the instructions to finish it.

Create NPM repository

By default, there are Maven repo (can be used by Gradle as well) and NuGet repo. To have a NPM repo, you need to manually create it.

Use “admin” to log into Nexus, Open “Repositories” page and click “Create repository“.

Select “npm proxy” in the Recipe list,

Put a name of the repository, such as “npm-all” and the “remote storage”.

Click “Create repository” to finish the creation. Now a npm proxy server is ready for serving. The repo URL is http://localhost:8081/repository/npm-all/.

NPM and Yarn Configuration

For npm and yarn, you can use the following commands to use this proxy server respectively.

All done!

Use Atlassian Confluence API to Copy and Create New Pages

For team management, we have a Confluence space to do weekly reporting. In that space, usually, one page is for a week and each page has the same template. So to copy these pages becomes a very boring work. No worries, there are Confluence APIs to help.

Installation and Connection to Confluence

Very simple and pip will help to finish everything.

After installation, use the following code to connect to Confluence.

Copy and Create New Page

Before creating new page, you need to get the body content of the template page.

Pay attention to the expand=’body.storage’. Without it, the returned page only contains the basic information, no body HTML.

Now you have the body and the rest work is a just for-loop.

Also you can use confluence.update_page() to update some existing pages.

References

Install Ubuntu 16.04 into Raspberry Pi 3 B+

After some investigation, I finally figured out how to install Ubuntu 16.04 into the new Raspberry Pi 3 B+.

Because the bootloader has been updated, with existing Ubuntu 16.04 images, Raspberry Pi 3 B+ can’t be booted. You will be stuck at the rainbow screen.

To fix it, the bootloader and some other driver files needs to be replaced. Here are the detailed instructions.

Download Ubuntu 16.04 Image File for Raspberry Pi 3

On this page, there are several options

I am familiar with Xfce, so I downloaded the xubuntu 16.04.2 image file.

Burn the Image into SD Card

On Windows, you can use a free tool named Etcher

Replace the Bootloader and Driver Files

After burning, there will have two partitions in the SD card. One for boot PI_BOOT, the other for root PI_ROOT

The latest Raspberry bootloader and other driver files can be downloaded from https://github.com/raspberrypi/firmware.

  1. Copy all boot files in folder boot into PI_BOOT partition.
  2. Copy all files/folders in folder modules into PI_BOOT/lib/modules

Boot it

Insert the SD card into Raspberry Pi 3 B+ and connect it the USB cable. It will be successfully booted.

A known problem so far. There has no default wireless network adapter. Need to use a USB wireless adapter.

References

Visual Studio Code – Better than Atom

之前推荐过Github的Atom,但之后它的表现不太让人满意,真的非常非常的慢!!

再之后就开始使用Visual Studio Code,非常惊艳的Microsoft产品,运行很快,各种插件也很全,还能跨平台。现在已经全面用它来替代Atom和Notepad++,大家也快去试试吧!😬

好用的Spacemacs!

作为Emacs粉,以前最麻烦的莫过于安装各种package和设置各种配置,常常把各种文件拷来拷去的。偶然的机会看到了Spacemacs这个项目,试用之后,感觉真是非常方便。

  • 安装简便,基本就是用git clone得到最新的版本,还可以简单的升级。
  • 默认的配置非常好用,反正比我之前的好,我在配置包丢在网盘上了。😁
  • 安装package非常简单,基本就是几条命令,再不用网上找各种包了。
  • 强大的个人定置,可以分Layer。但其实对我没什么用,基本的已经很好了。

Emacs粉应该果断试试,不会让你失望的!戳这!😋