Skip to content

Instantly share code, notes, and snippets.

@victoryang00
Created December 30, 2022 04:39
Show Gist options
  • Save victoryang00/d1f0ef40e542e35f459521b35949a7a8 to your computer and use it in GitHub Desktop.
Save victoryang00/d1f0ef40e542e35f459521b35949a7a8 to your computer and use it in GitHub Desktop.
#! /usr/bin/python3
import sys,os,re
res="/home/victoryang00/spack/opt/spack/linux-ubuntu22.10-skylake/gcc-12.2.0/cuda-11.8.0-g4j5qa25yjuaocqv54fphzzmuoswljhl/bin/nvcc.bak "+(" ".join(sys.argv[1:])).replace("-fPIC","").replace("-no-canonical-prefixes","").replace("-iquote","-I").replace("-g0","")
if res.__contains__("-o") and res.__contains__(".d"):
# res = res.split("\n")[1]
# res_d=res.split("-o")[0]
found = re.findall(r"-o .+\.d",res)
# print("found",found)
res=res.replace(found[0],"")
# print(res+">"+found[0].replace("-o ",""))
os.system(res.replace("--compiler-options","").replace("-M","")+"&>"+found[0].replace("-o ","")+"|| 0")
# print("nvcc"+res.replace("--compiler-options","").split("nnvcc")[1])
# print(res.replace("--compiler-options","")+"&>"+found[0].replace("-o ","")+"|| 0")
#os.system(res.split("\n")[1])
else:
os.system(res.replace("--compiler-options","").replace("--compiler-bindir=/usr/bin/gcc","--compiler-bindir=/usr/bin/gcc-11"))
# print(res.replace("--compiler-options",""))
print(" ".join(sys.argv[1:]))
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment