Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

B1gM8c
Copy link
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
Collaborator

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
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
Collaborator

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
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
Collaborator

slaren commented Apr 22, 2023

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

@slaren slaren closed this Apr 22, 2023
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