Progress.
This commit is contained in:
		
							parent
							
								
									89be6b8542
								
							
						
					
					
						commit
						ecadf1e9a2
					
				
							
								
								
									
										13
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,4 +1,4 @@ | |||||||
| all: build build_free build_rpylib run_free | all: build build_rd build_free build_rpylib run_rd | ||||||
| 
 | 
 | ||||||
| # Variables for compiler and flags
 | # Variables for compiler and flags
 | ||||||
| CC = gcc | CC = gcc | ||||||
| @ -13,6 +13,12 @@ build_free: | |||||||
| 	$(CC) -DOLLAMA main.c $(CFLAGS) -o rf | 	$(CC) -DOLLAMA main.c $(CFLAGS) -o rf | ||||||
| 	publish rf | 	publish rf | ||||||
| 
 | 
 | ||||||
|  | build_rd: | ||||||
|  | 	$(CC) -DRD main.c $(CFLAGS) -o rd | ||||||
|  | 	publish rd | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| build_rpylib: | build_rpylib: | ||||||
| 	$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3 | 	$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3 | ||||||
| 	publish rpylib.so | 	publish rpylib.so | ||||||
| @ -21,4 +27,7 @@ run: | |||||||
| 	./r --verbose | 	./r --verbose | ||||||
| 
 | 
 | ||||||
| run_free: | run_free: | ||||||
| 	./rf --verbose | 	./rf --verbose  | ||||||
|  | 
 | ||||||
|  | run_rd: | ||||||
|  | 	./rd --verbose  | ||||||
|  | |||||||
							
								
								
									
										33
									
								
								malloc.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								malloc.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | #ifndef R_MALLOC | ||||||
|  | #define R_MALLOC | ||||||
|  | #include <malloc.h> | ||||||
|  | 
 | ||||||
|  | long long int r_malloc_alloc_count = 0; | ||||||
|  | long long int r_malloc_alloc_total = 0; | ||||||
|  | 
 | ||||||
|  | void *r_malloc(size_t size) { | ||||||
|  |   r_malloc_alloc_count++; | ||||||
|  |   r_malloc_alloc_total++; | ||||||
|  | 
 | ||||||
|  |   return malloc(size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void r_free(void *ptr) { | ||||||
|  |   r_malloc_alloc_count--; | ||||||
|  | 
 | ||||||
|  |   free(ptr); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void r_malloc_stats() { | ||||||
|  |   fprintf(stderr, "r_malloc_alloc_count: %lld\n", r_malloc_alloc_count); | ||||||
|  |   fprintf(stderr, "r_malloc_alloc_total: %lld\n", r_malloc_alloc_total); | ||||||
|  |   fprintf(stderr, "r_malloc_freed_total: %lld\n", | ||||||
|  |           r_malloc_alloc_total - r_malloc_alloc_count); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #define malloc(x) r_malloc(x) | ||||||
|  | #define free(x) r_free(x) | ||||||
|  | 
 | ||||||
|  | #include <stdio.h> | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
							
								
								
									
										15
									
								
								r.h
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								r.h
									
									
									
									
									
								
							| @ -7,13 +7,26 @@ | |||||||
| #include <string.h> | #include <string.h> | ||||||
| bool is_verbose = false; | bool is_verbose = false; | ||||||
| 
 | 
 | ||||||
|  | #ifndef RD | ||||||
| #ifndef OLLAMA | #ifndef OLLAMA | ||||||
| char *models_api_url = "https://api.openai.com/v1/models"; | char *models_api_url = "https://api.openai.com/v1/models"; | ||||||
| // char *completions_api_url = "https://ollama.molodetz.nl/v1/chat/completions";
 | // char *completions_api_url = "https://ollama.molodetz.nl/v1/chat/completions";
 | ||||||
| char *completions_api_url = "https://api.openai.com/v1/chat/completions"; | char *completions_api_url = "https://api.openai.com/v1/chat/completions"; | ||||||
| char *advanced_model = "gpt-4o-mini"; | char *advanced_model = "gpt-4o-mini"; | ||||||
| char *fast_model = "gpt-3.5-turbo"; | char *fast_model = "gpt-3.5-turbo"; | ||||||
| #else | #endif  | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifdef RD | ||||||
|  | 
 | ||||||
|  | char *models_api_url = "https://api.openai.com/v1/models"; | ||||||
|  | char *completions_api_url = "https://api.deepinfra.com/v1/openai/chat/completions"; | ||||||
|  | //char *advanced_model = "meta-llama/Meta-Llama-3.1-8B-Instruct";
 | ||||||
|  | char *advanced_model = "google/gemini-1.5-flash"; | ||||||
|  | char *fast_model = "Qwen/Qwen2.5-Coder-32B-Instruct"; | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | #ifdef OLLAMA | ||||||
| char *models_api_url = "https://ollama.molodetz.nl/v1/models"; | char *models_api_url = "https://ollama.molodetz.nl/v1/models"; | ||||||
| char *completions_api_url = "https://ollama.molodetz.nl/v1/chat/completions"; | char *completions_api_url = "https://ollama.molodetz.nl/v1/chat/completions"; | ||||||
| char *advanced_model = "qwen2.5:3b"; | char *advanced_model = "qwen2.5:3b"; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user