Skip to content

Instantly share code, notes, and snippets.

View lijiansong's full-sized avatar
🛠️
造轮子...

Json Lee lijiansong

🛠️
造轮子...
View GitHub Profile

[toc]

1. upgrade gcc to 11.4.

2. set the envrionment of cuda.

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH                     
export LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH                        
export LLVM_BUILD_DIR=/project/xingjinglu/llvm-project/build                                                            
export PATH=/usr/local/nvidia/bin:$PATH    
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
@lijiansong
lijiansong / gist:47abc6063f1503b57d6d9efc36ddb287
Created August 23, 2023 06:49 — forked from npezolano/gist:5477576
Changing the thread name on C++11
#include <thread>
#include <iostream>
#include <pthread.h>
using namespace std;
void foo()
{
string s = "thread1";
char name[16];
@lijiansong
lijiansong / Makefile
Created August 16, 2023 12:25 — forked from 38/Makefile
A Minimal LLVM JIT example for LLVM-5
jit-toy: jit-toy.cpp
clang++ -g -o $@ $^ $(shell /usr/lib/llvm-5.0/bin/llvm-config --cxxflags --ldflags --system-libs --libs core)
@lijiansong
lijiansong / pgo.sh
Created March 13, 2023 12:27 — forked from daniel-j-h/pgo.sh
pgo: profile guided optimization with gcc
# Instrument binaries, pgo data to /data/pgo, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-generate=/data/pgo' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
# Run instrumented program, generate and write pgo data
./runIt
# Use profile data and feed into gcc, correct for threading counter noise, serial make is important to not confuse the pgo generator
env CXXFLAGS='-march=native -fprofile-dir=/data/pgo -fprofile-use=/data/pgo -fprofile-correction' cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 1
@lijiansong
lijiansong / gdbinit
Created December 14, 2022 08:16 — forked from chrislongo/gdbinit
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@lijiansong
lijiansong / cheat_sheet.txt
Created November 14, 2022 01:30
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@lijiansong
lijiansong / src.Makefile.patch
Created September 8, 2022 07:43 — forked from dcarrith/src.Makefile.patch
fPIC Patch file for src/Makefile for lua-5.3.0
--- src/Makefile.original2015-02-27 10:53:53.130125907 -0500
+++ src/Makefile 2015-02-27 10:53:24.674126798 -0500
@@ -7,7 +7,7 @@
PLAT= none
CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -fPIC
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
@lijiansong
lijiansong / Makefile
Created September 8, 2022 03:49 — forked from thejohnny/Makefile
Build shared libraries for lua 5.1.4
--- lua-5.1.4/Makefile 2008-08-12 00:40:48.000000000 +0000
+++ lua-5.1.4-shared-lib/Makefile 2009-01-13 22:01:33.000000000 +0000
@@ -43,7 +43,7 @@
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so
TO_MAN= lua.1 luac.1
@lijiansong
lijiansong / clang-cc1-options.txt
Last active March 6, 2022 16:16
clang-cc1-options.txt
OVERVIEW: LLVM 'Clang' Compiler: http://clang.llvm.org
USAGE: clang -cc1 [options] <inputs>
OPTIONS:
-add-plugin <name> Use the named plugin action in addition to the default action
-analyze-function <value>
Run analysis on specific function
-analyzer-checker-help Display the list of analyzer checkers that are available
-analyzer-checker <value>