Skip to content

Fix: Issue with CUBLAS compilation error due to missing -fPIC flag#1127

Closed
B1gM8c wants to merge 2 commits intoggml-org:masterfrom
B1gM8c:master
Closed

Fix: Issue with CUBLAS compilation error due to missing -fPIC flag#1127
B1gM8c wants to merge 2 commits intoggml-org:masterfrom
B1gM8c:master

Conversation

@B1gM8c
Copy link
Copy Markdown
Contributor

@B1gM8c B1gM8c commented Apr 22, 2023

Fix: Issue with CUBLAS compilation error due to missing -fPIC flag

Fix: Issue with CUBLAS compilation error due to missing `-fPIC` flag
@slaren
Copy link
Copy Markdown
Member

slaren commented Apr 22, 2023

This should have been fixed already with the addition of --forward-unknown-to-host-linker and $(CXXFLAGS) to the command line. Are you sure that it isn't working?

@B1gM8c
Copy link
Copy Markdown
Contributor Author

B1gM8c commented Apr 22, 2023

--forward-unknown-to-host-linker

Yes, it does seem like it's not working. I'm getting a similar error message as what was reported in the previous issues when I try to compile it.
#1077

@slaren
Copy link
Copy Markdown
Member

slaren commented Apr 22, 2023

I think I see the issue, can you test if replacing --forward-unknown-to-host-linker with --forward-unknown-to-host-compiler works? We should pass all the C++ flags to the nvcc compiler anyway, only -fPIC is not enough.

@B1gM8c
Copy link
Copy Markdown
Contributor Author

B1gM8c commented Apr 22, 2023

I think I see the issue, can you test if replacing --forward-unknown-to-host-linker with --forward-unknown-to-host-compiler works? We should pass all the C++ flags to the nvcc compiler anyway, only -fPIC is not enough.

You're right. I tested it, and modifying it to NVCCFLAGS = --forward-unknown-to-host-compiler -arch=native works.

ifdef LLAMA_CUBLAS
	CFLAGS    += -DGGML_USE_CUBLAS -I/usr/local/cuda/include
	LDFLAGS   += -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L/usr/local/cuda/lib64
	OBJS      += ggml-cuda.o
	NVCC      = nvcc
	NVCCFLAGS = --forward-unknown-to-host-compiler -arch=native
ggml-cuda.o: ggml-cuda.cu ggml-cuda.h

Fix: Issue with CUBLAS compilation error
@slaren slaren mentioned this pull request Apr 22, 2023
@slaren
Copy link
Copy Markdown
Member

slaren commented Apr 22, 2023

Superseded by #1128. I have kept your commits to give you credit for you work, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants