Ollama working with deepseek-r1, deepseek-coder, mistral, Nvidia gpu and emacs with gptel on Freebsd 14.2

I have installed the Ollama package on Freebsd 14.2 quarterly
on my Dell XPS 15 2019 with a NVIDIA GeForce GTX 1650 and 16 gig of ram

ouput of nvidia-smi

Code:
nv-sglrun nvidia-smi

Code:
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.127.05             Driver Version: 550.127.05     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+

Ollama lets you download and run large language models.


I have installed deepseek-r1, deepseek-coder, mistral and zephyr
i use gptel with emacs to enter the queries and output the response in a org buffer

Ollama also uses the NVIDIA GeForce GTX 1650

ollama set up notes


emacs config

install the gptel package in emacs


i have installed the following models

1 - deepseek-r1


DeepSeek’s first-generation reasoning models, achieving performance comparable to OpenAI-o1 across math, code, and reasoning tasks.

2 - deepseek-coder


DeepSeek Coder is trained from scratch on both 87% code and 13% natural language in English and Chinese. Each of the models are pre-trained on 2 trillion tokens.

3 - mistral


Mistral is a 7B parameter model, distributed with the Apache license. It is available in both instruct (instruction following) and text completion.

4 - zephyr


Zephyr is a series of fine-tuned versions of the Mistral and Mixtral models that are trained to act as helpful assistants.

Install Ollama

Code:
sudo pkg install ollama

You need to run the Ollama server to pull and run models

To run ollama, open 2 terminals.

In the first terminal, run:

Code:
OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start

you can also create a shell script with the above code to make it easier to run

ollama-server

Code:
#!/bin/sh

OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start

In the second terminal pull the model you want to install
you need to make sure the ollama server is running

deepseek-r1:7b install

use ollama to pull deepseek-r1:7b

Code:
ollama pull deepseek-r1:7b

you can then run deepseek-r1:7b

Code:
ollama run deepseek-r1:7b

deepseek-coder install

use ollama to pull deepseek-coder

Code:
ollama pull deepseek-coder

you can then run deepseek-coder

Code:
ollama run deepseek-coder

mistral install

use ollama to pull mistral

Code:
ollama pull mistral

you can then run mistral

Code:
ollama run mistral:latest

zephyr install

use ollama to pull zephyr

Code:
ollama pull zephyr

you can then run zephyr

Code:
ollama run zephyr

check if ollama is running

you can check if ollama is running and kill it if needed

Code:
pgrep ollama

and kill the ollama server by running

Code:
pkill ollama

Ollama lama server running

Makefile:
OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start

20250120_23h09m39s_grim.png


Ollama running deepseek-r1:7b

Code:
ollama run deepseek-r1:7b

20250120_23h09m47s_grim.png


nvida-smi

run nvidia-smi with the --loop=1 option which updates the output every second

showing the ollama llama server and the process for the query

Code:
nvidia-smi --loop=1

20250120_23h13m00s_grim.png


deepseek-r1:7b running in emacs using gptel

20250120_23h15m58s_grim.png



deepseek-r1:7b

i gave deepseek-r1:7b the following prompt in emacs using gptel

explain the following code

and gave it this code

Code:
(add-to-list 'display-buffer-alist
   '("^*Gemini*" display-buffer-same-window))

which sets Gemini buffers in gptel to be display in the same emacs window
instead of a split window which is the default

here is the conversation with the prompt set to programming

*** explain the following code

(add-to-list 'display-buffer-alist
'("^*Gemini*" display-buffer-same-window))



<think>
Okay, so I'm trying to understand this LISP code: =(add-to-list 'display-buffer-alist '("^*Gemini*" display-buffer-same-window))=. Let me break it down step by step.

First, =add-to-list= is a Common Lisp function used to modify lists. It's commonly seen in environments where you need dynamic list operations. The syntax of =add-to-list= usually looks like =(add-to-list list object)=, so here, the first argument is ='display-buffer-alist=.

Wait, what does ='display-buffer-alist= refer to? In LISP, single quotes typically denote strings. But when used as a variable name with an apostrophe, it's actually just a literal symbol or variable name without parsing. So =display-buffer-alist= must be a list variable that we're modifying.

Next part is the string ="^*Gemini*"=. That looks like a file path or maybe a display buffer name. The caret and asterisks might indicate some kind of placeholder or special syntax for displaying Gemini in a graphical window, perhaps using a specific protocol or format.

The third argument is =display-buffer-same-window=, which I assume is another variable that probably points to a function or macro used for managing display buffers within the same window. So when we call this function, it likely adds some configuration related to the display buffer to our list.

Putting it all together: this line seems to be adding an entry to a display buffer alist. The string ="^*Gemini*"= is probably a key or identifier for that particular display buffer in the alist. Then, by calling =display-buffer-same-window=, we're invoking some function that handles adding parameters related to this display buffer.

I'm not entirely sure about all the nuances here, but it looks like we're dynamically managing configuration settings for display buffers using LISP functions.
</think>

The code is using the =add-to-list= function in Common Lisp to modify an alist (a list) by adding a new entry. The syntax is:

1. ='display-buffer-alist'=: This refers to the name of the alist where we want to add an entry.
2. ="^*Gemini*"=: This is likely the key or identifier for the specific display buffer in the alist.
3. =display-buffer-same-window=: This appears to be a function or macro that manages the same window's display buffer configuration.

The code adds a new entry to the 'display-buffer-alist' with key "^/Gemini/", and uses the provided function to handle related display buffer settings for the same window.

#+begin_src lisp
(add-to-list 'display-buffer-alist '("^*Gemini*" display-buffer-same-window))
#+end_src

I wil do a video tutorial on installing ollama,
running the ollama server and pulling and running the models

and setting up emacs with gptel
 
It does work and it uses Vulkan.
It worked on my as well but many issues... sometimes ollama wont start, t/s are diabolical and all over the place.
Linux+CUDA+ollama + deepseek-coder:33b = 17/ts
FreeBSD 14.2-Stable + deepseek-coder:33b=4/ts
FreeBSD 14.2-Stable + mistral 4gb = 12t/s
Makes no sense ... but i never tested mistral 4gb on Linux.
Oatmeal wont even run ...
I did same way as you did.Maybe its my GPU ... maybe Vulkan has bad relationship with Volta`s gpu`s who knows.
I would like to try on AMD gpu but i have issues with drivers and so i think i wont be able to have descent performance.
P.s. i have not tried to run ollama+neovim+FreeBSD but if oatmeal didnt worked, ollama sometimes could not even start ( not using web ui) im sure neovim would had same issues.
 
you can get EOF when running the model sometimes
so you just need to run the model again and it works

another thing to watch out for is if ollama stops working
you need to use pkill to stop the process before running it again

Code:
pgrep ollama

PHP:
pkill ollama

an example using Gemini

rewrite this text as a pirate

Shiver me timbers! Ye might get an EOF error, just run the model again. If Ollama be givin' ye trouble, use =pkill= to keelhaul the process afore tryin' again.
 
you can also start ollama with

Code:
ollama serve

instead of using

Code:
OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start
 
i have the libc6-shim package installed
which provides the nv-sglrun command

Code:
Yes Master ? nv-sglrun nvidia-smi
shim init
Tue Jan 21 18:57:31 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.127.05             Driver Version: 550.127.05     CUDA Version: 12.4     |

i also have the linuxulator installed

my root dotfiles


my dotfiles


bin directory


notes on github


here is the a video tutorial on setting up ollama on Freebsd

 
That sounds amazing.
Did you use Linuxulator for CUDA?
He runs ollama on Vulkan, he does not run on CUDA and CUDA not needed.


NapoleonWils0n can you run your model inside terminal with --verbose output ? it will show t/s
Just for curiosity - have you tried to run on linux with same gpu and compare t/s ?
I skipped quickly torug your video and noted around 1t/s - does your model t/s differs model to model or they are mostly same speed ?
 
can you run your model inside terminal with --verbose output ? it will show t/s

sure will do mate

have you tried to run on linux with same gpu and compare t/s ?

ollama is running on my main Freebsd machine,
so i cant wipe it and install linux on it

i have found even installing linux on an external hard drive can mess with the internal bootloader
so i dont really want to risk that on my main machine

I skipped quickly torug your video and noted around 1t/s - does your model t/s differs model to model or they are mostly same speed ?

some models are quicker than others at outputting the response
 
ollama output using the --verbose option when running a model

1 - deepseek-r1:7b

Code:
ollama run --verbose deepseek-r1:7b

prompt

write a shell script that outputs hello world

Code:
total duration:       1m8.189666221s
load duration:        100.87756ms
prompt eval count:    12 token(s)
prompt eval duration: 1.847238s
prompt eval rate:     6.50 tokens/s
eval count:           273 token(s)
eval duration:        1m6.160223s
eval rate:            4.13 tokens/s


2 - deepseek-coder

Code:
ollama run --verbose deepseek-coder

prompt

write a shell script that outputs hello world

Code:
total duration:       7.886106702s
load duration:        64.11193ms
prompt eval count:    78 token(s)
prompt eval duration: 620.702ms
prompt eval rate:     125.66 tokens/s
eval count:           233 token(s)
eval duration:        7.077387s
eval rate:            32.92 tokens/s


3 - llama3.2

Code:
ollama run --verbose llama3.2:latest

prompt

write a shell script that outputs hello world

Code:
total duration:       12.581408373s
load duration:        117.171588ms
prompt eval count:    33 token(s)
prompt eval duration: 693.426ms
prompt eval rate:     47.59 tokens/s
eval count:           178 token(s)
eval duration:        11.684343s
eval rate:            15.23 tokens/s

4 - mistral

Code:
ollama run --verbose mistral:latest

prompt

write a shell script that outputs hello world

Code:
total duration:       26.783368951s
load duration:        46.557965ms
prompt eval count:    14 token(s)
prompt eval duration: 1.203762s
prompt eval rate:     11.63 tokens/s
eval count:           194 token(s)
eval duration:        25.450529s
eval rate:            7.62 tokens/s

5 - zephyr

Code:
ollama run --verbose zephyr

prompt

write a shell script that outputs hello world

Code:
total duration:       28.613196419s
load duration:        69.555133ms
prompt eval count:    29 token(s)
prompt eval duration: 1.67064s
prompt eval rate:     17.36 tokens/s
eval count:           202 token(s)
eval duration:        26.787069s
eval rate:            7.54 tokens/s
 
Very interesting ... very very!
I need to get ollama again and test with smaller models and run same request as you do.
My deepseek-coder:33b was running 4t/s only, mistral - 12t/s plus i was asking more complicated questions and eval had more tokens, way more tokens.

Time to dust off my keyboard again and do some testing.
 
im starting the ollama lama server with this command

Code:
OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start

which was the message printed when i install the ollama pkg
other than that im not doing anything special
 
I did same stuff but i was asking different questions and running different models just because i have 32GB gpu.
So for me to see difference i have to run same models as you and ask same questions and then try to evaluate it and see what is what.
 
deepseek-r1 test

prepend foo and append bar to the following text, without any spaces between the words

cat
dog
frog

<think>
Okay, so I need to prepend "foo" and append "bar" to each line of this text:

cat
dog
frog

Alright, first off, what does prepend mean? From what I remember, prepend is when you add something at the beginning of something else. So in this case, adding "foo" before each line.

And append means adding something at the end. So after each line, I'll add "bar".

So for the first line, "cat", it would become "foo cat bar". Same for the others.

But wait, there's an additional instruction: without any spaces between the words. So instead of "foo cat bar", it should be "foocatbar" on each line.

Let me make sure I'm doing this right. Each original line is just a word with no spaces or anything else. After prepending and appending, it will be "foowsomeWordbar" for each line.

Yes, that makes sense. So the modified text should look like:

foocatbar
foodogbar
foofrogbar

I think that's all there is to it.
</think>

The modified text with "foo" prepended and "bar" appended to each word without any spaces is:

foocatbar
foodogbar
foofrogbar
 
google gemini

prepend foo and append bar to each line of the following text, without any spaces between the words

cat
dog
frog

response

foocatbar
foodogbar
frogbobar

so in this simple test deepseek-r1 does a better job
than google gemini
 
deepseek-r1 programming prompt creating a url

this creates a streetview link ( or a photosphere ) by prepending the google streetview url
to the latitude and longitude for a location, in this case the Newcastle United statdium


54.975545,-1.6215583

<think>
Alright, let's break this down step by step. The user has provided a specific instruction: they want to prepend a URL string to a given set of coordinates.

First, understanding what "prepending" means here is crucial. It involves adding the specified string at the very beginning before the rest of the text follows. So in this case, we're taking the URL path and placing it at the start.

Looking at the example provided:
- The original URL was "https://www.google.com/maps/@?api=1&map_action=pano&viewpoint="
- The coordinates were split into latitude and longitude separated by a comma.

The user is now asking to prepend the same URL string but with different coordinates: "54.975545,-1.6215583"

I need to make sure that when I add this string, it doesn't disrupt the existing structure of the URL. The key here is ensuring proper formatting and syntax.

Looking at the example, the prepended string ends with "viewpoint=" followed by the coordinates. It's essential to include everything after "=" without adding any extra characters or spaces unless they're part of the original data.

I should also ensure that there are no trailing spaces before the comma separating latitude and longitude. Proper formatting prevents potential issues when loading the map, which is crucial for functionality.

Putting it all together, I'll replicate the structure from the example but substitute the coordinates provided by the user.
</think>

 
deepseek-r1:7b prepending a url to a list of coordinates

i gave deepseek-r1:7b a list of 38 latitude and longitude coordinates,
and asked it to prepend the url for google street view to each of them using the programming prompt

im only showing 3 results in the output,
took a couple of minutes to process

i tried the same thing with llama3.2 and it mangled the urls

heres the org file with the prompt and response

:PROPERTIES:
:GPTEL_MODEL: deepseek-r1:7b
:GPTEL_BACKEND: Ollama
:GPTEL_SYSTEM: You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.
:GPTEL_BOUNDS: ((1463 . 5329))
🔚

*** prepend this url https://www.google.com/maps/@?api=1&map_action=pano&viewpoint= to each line of the text below which are a list of latitude and longitude coordinates. dont modify the url or the input text, dont encode the url and dont try and write a script. output each line of input with the url prepended as plain text with each result on a new line
:PROPERTIES:
:GPTEL_TOPIC: prepend-this-url-https://www.google.com/maps/@?api
🔚

51.532490,-0.111180
51.5304533,-0.1130917
51.523601,-0.116237

<think>
Okay, so the user has given me a task where I need to prepend a specific URL to each line of text containing latitude and longitude coordinates. Let's break this down.

First, the URL they provided is https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=. I notice that it uses placeholders for the viewpoint parameters, which are exactly what the coordinates provide—latitude and longitude. So, each line of the input text has these two numbers, which should replace the viewpoint part.

Looking at the input, there's a block of properties with some lines containing coordinates separated by commas. My job is to take each coordinate pair, remove any existing viewpoint parameters (if present), and add the URL before each pair.

Wait, but in this case, all the lines are just plain numbers without any other text, so I don't have to worry about existing viewpoints. It's straightforward: prepend the URL to each line as is.

I also need to make sure that I don't modify the URL or the input text at all. The output should be each coordinate line prefixed with the URL, and each result on a new line without any additional text or encoding.

Hmm, so for example, taking the first coordinate "51.532490,-0.111180", I just need to add the URL before it, making sure there's no space between the URL and the first digit of the latitude.

I should also ensure that each modified line is on its own new line without any extra spaces or formatting. Since the user doesn't want a script or extra code, just plain text with each coordinate line prefixed correctly.

Alright, so I'll go through each line in the input and prepend the URL to it, ensuring each one ends up on a separate line as required.
</think>


the org file doesnt have emojis in it
the forum added those because its happy i guess which must mean the forum has become self aware
 
DeepSeek is a big deal.

Among other things the fact that it is open source got it into university programs. There is a generation of AI researchers growing up who default to DeepSeek right now.

It's too bad that the same level of openness wasn't in the vision of Western companies.
 
deepseek is the most impressive model i have tried

it actually thinks things through,
whereas it seems the others just spit out training data

it also easy to install

unlike programs like Whisperx and MeloTTS which i installed in a linux jail with conda
but wont run because of cuda os errors
 
deepseek-r1:7b programming prompt

sexagesimal-time script
calculate sexagesimal duration by subtacting end time from start time

convert the following script into a c program

Code:
#!/bin/sh

#===============================================================================
# sexagesimal-time
# calculate sexagesimal duration by subtacting end time from start time
#===============================================================================

# dependencies:
# awk

#===============================================================================
# script usage
#===============================================================================

usage () {
# if argument passed to function echo it
[ -z "${1}" ] || echo "! ${1}"
# display help
echo "\
calculate sexagesimal duration by subtacting end time from start time
$(basename "$0") -s 00:00:00 -e 00:00:00"
exit 2
}


#===============================================================================
# error messages
#===============================================================================

INVALID_OPT_ERR='Invalid option:'
REQ_ARG_ERR='requires an argument'
WRONG_ARGS_ERR='wrong number of arguments passed to script'


#===============================================================================
# check the number of arguments passed to the script
#===============================================================================

[ $# -gt 0 ] || usage "${WRONG_ARGS_ERR}"


#===============================================================================
# getopts check the options passed to the script
#===============================================================================

while getopts ':s:e:h' opt
do
  case ${opt} in
     s) start="${OPTARG}";;
     h) usage;;
     e) end="${OPTARG}";;
     \?) usage "${INVALID_OPT_ERR} ${OPTARG}" 1>&2;;
     :) usage "${INVALID_OPT_ERR} ${OPTARG} ${REQ_ARG_ERR}" 1>&2;;
  esac
done
shift $((OPTIND-1))


#===============================================================================
# function
#===============================================================================

sexagesimal () {
printf "%s %s\n" "${start}" "${end}" \
| awk '
        {
          start = $1
          end = $2
          if (start ~ /:/) {
            split(start, t, ":")
            sseconds = (t[1] * 3600) + (t[2] * 60) + t[3]
          }
          if (end ~ /:/) {
            split(end, t, ":")
            eseconds = (t[1] * 3600) + (t[2] * 60) + t[3]
          }
          duration = eseconds - sseconds
          printf("%s\n"), duration
     }' \
| awk -F. 'NF==1 { printf("%02d:%02d:%02d\n"), ($1 / 3600), ($1 % 3600 / 60), ($1 % 60) }\
NF==2 { printf("%02d:%02d:%02d.%s\n"), ($1 / 3600), ($1 % 3600 / 60), ($1 % 60), ($2) }'
}


#===============================================================================
# run function
#===============================================================================

sexagesimal

and this is the response from deepseek-r1:7b

<think>
Okay, so I need to convert a given shell script into a C program. The original script is called sexagesimal-time and it's supposed to calculate the duration between two times in sexagesimal format (hours:minutes:seconds).

First, let me understand what the script does. It uses 'awk' to process the input times. The main function seems to parse the start and end times, convert them into total seconds, subtract to get the duration, and then convert back to hours, minutes, and seconds for output.

Now, I need to translate this logic into C. I'll structure the code with functions similar to how they were used in the script. The main steps are:

1. *Function Definitions*:
- A function to read command line arguments.
- A function to check options using getopts.
- A sexagesimal conversion function that handles input parsing and calculation.

2. *Argument Handling*:
- Ensure exactly two time strings are provided (start and end).
- Use 'getopt' functions to handle the '-s', '-e', and '-h' options, with error checking if options are invalid or too many arguments.

3. *Parsing Times*:
- Each time string is split into hours, minutes, seconds.
- Convert these into total seconds for calculation.

4. *Duration Calculation*:
- Subtract start_seconds from end_seconds to get the duration in seconds.

5. *Formatting Output*:
- Convert the total duration back into hh:mm:ss format with leading zeros where necessary.

6. *Error Handling*:
- Check that exactly two arguments are provided.
- Ensure that if optional flags are used, they don't cause issues.

I'll start by writing the main function which checks for command line options and arguments. Then, define the sexagesimal_time function to handle the time parsing and calculation.

In the sexagesimal_time function, I'll write helper functions parse_time and convert_time. Parse_time will split a time string into components and convert them into seconds. Convert_time will take total seconds and format them back into hh:mm:ss.

I need to make sure that all possible cases are handled, like when hours exceed 24 (so output is something like 25:01:30) or when the duration is negative (though in this case, maybe it's impossible as per script usage).

Testing with examples should help. For instance, if start is "8:15:30" and end is "9:45:59", the duration should be 1:30:29.

I also need to ensure that the program exits correctly with non-zero status codes for errors like invalid options or incorrect number of arguments.

Finally, I'll compile all these functions into a C program, ensuring that main() calls them appropriately after command line argument parsing and option handling.
</think>

this is the c code it came up with

Code:
#include <stdio.h>
#include <stdlib.h>

void usage(const char *message) {
    printf("%s\n", message);
    exit(EXIT_FAILURE);
}

int sexagesimal_time(char *start, char *end) {
    int64_t start_seconds = parse_time(start);
    int64_t end_seconds = parse_time(end);

    if (start_seconds > end_seconds) {
        return -1;
    }

    int64_t duration = end_seconds - start_seconds;

    return convert_time(duration);
}

int* parse_time(const char *time) {
    const char *part[3];
    int64_t total = 0;

    if (strspn(time, ": ") == 0) {
        part[0] = time;
        return &total;
    }

    part[1] = strchr(time, ':')[0];
    part[2] = time[strlen(time)-1];

    int64_t hours = stol(part[1]);
    int64_t minutes = stol(part[2]);
    int64_t seconds = 0;

    total += hours * 3600;
    total += minutes * 60;
    total += seconds;

    return &total;
}

int* convert_time(int64_t seconds) {
    int64_t h, m, s, d;

    if (seconds < 0) {
        // Return error value
        return NULL;
    }

    h = seconds / 3600;
    m = (seconds % 3600) / 60;
    s = seconds % 60;

    // Add fractional part if needed?
    int64_t fraction = seconds - ((int64_t)h * 3600 + (int64_t)m * 60 + (int64_t)s);

    if (!fraction) {
        return &h;
    } else {
        char buf[18];
        snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%02d", h, m, s, fraction);
        return &buf_strlen(buf);
    }
}

int main(int argc, char **argv) {
    if (argc != 3 || argv[1] == NULL || argv[2] == NULL) {
        usage("invalid number of arguments");
    }

    char start_time[100];
    printf("Enter start time in 'hh:mm:ss' format: ");
    if (!fgets(start_time, sizeof(start_time), stdin)) {
        return usage("Failed to read input");
    }

    char end_time[100];
    printf("Enter end time in 'hh:mm:ss' format: ");
    if (!fgets(end_time, sizeof(end_time), stdin)) {
        return usage("Failed to read input");
    }

    int64_t result = sexagesimal_time(start_time, end_time);

    switch (result) {
        case -1:
            exit(EXIT_FAILURE);
        default:
            char *output;
            if (output = convert_time(result)) {
                printf("%s\n", output);
                free(output);
            } else {
                printf("Invalid time format\n");
            }
            exit(EXIT_SUCCESS);
    }

    return 0;
}

compile

Code:
cc -o sexagesimal-time sexagesimal-time.c

errors

Code:
sexy-time.c:10:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   10 |     int64_t start_seconds = parse_time(start);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:10:29: warning: call to undeclared function 'parse_time'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   10 |     int64_t start_seconds = parse_time(start);
      |                             ^
sexy-time.c:11:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   11 |     int64_t end_seconds = parse_time(end);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:17:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   17 |     int64_t duration = end_seconds - start_seconds;
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:19:12: warning: call to undeclared function 'convert_time'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   19 |     return convert_time(duration);
      |            ^
sexy-time.c:22:6: error: conflicting types for 'parse_time'
   22 | int* parse_time(const char *time) {
      |      ^
sexy-time.c:10:29: note: previous implicit declaration is here
   10 |     int64_t start_seconds = parse_time(start);
      |                             ^
sexy-time.c:24:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   24 |     int64_t total = 0;
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:26:9: warning: call to undeclared library function 'strspn' with type 'unsigned long (const char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   26 |     if (strspn(time, ": ") == 0) {
      |         ^
sexy-time.c:26:9: note: include the header <string.h> or explicitly provide a declaration for 'strspn'
sexy-time.c:28:16: warning: incompatible pointer types returning '__int64_t *' (aka 'long *') from a function with result type 'int *' [-Wincompatible-pointer-types]
   28 |         return &total;
      |                ^~~~~~
sexy-time.c:28:17: warning: address of stack memory associated with local variable 'total' returned [-Wreturn-stack-address]
   28 |         return &total;
      |                 ^~~~~
sexy-time.c:31:15: warning: call to undeclared library function 'strchr' with type 'char *(const char *, int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   31 |     part[1] = strchr(time, ':')[0];
      |               ^
sexy-time.c:31:15: note: include the header <string.h> or explicitly provide a declaration for 'strchr'
sexy-time.c:31:13: error: incompatible integer to pointer conversion assigning to 'const char *' from 'char'; take the address with & [-Wint-conversion]
   31 |     part[1] = strchr(time, ':')[0];
      |             ^ ~~~~~~~~~~~~~~~~~~~~
      |               &
sexy-time.c:32:20: warning: call to undeclared library function 'strlen' with type 'unsigned long (const char *)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   32 |     part[2] = time[strlen(time)-1];
      |                    ^
sexy-time.c:32:20: note: include the header <string.h> or explicitly provide a declaration for 'strlen'
sexy-time.c:32:13: error: incompatible integer to pointer conversion assigning to 'const char *' from 'const char'; take the address with & [-Wint-conversion]
   32 |     part[2] = time[strlen(time)-1];
      |             ^ ~~~~~~~~~~~~~~~~~~~~
      |               &
sexy-time.c:34:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   34 |     int64_t hours = stol(part[1]);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:34:21: warning: call to undeclared function 'stol'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   34 |     int64_t hours = stol(part[1]);
      |                     ^
sexy-time.c:35:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   35 |     int64_t minutes = stol(part[2]);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:36:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   36 |     int64_t seconds = 0;
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:42:12: warning: incompatible pointer types returning '__int64_t *' (aka 'long *') from a function with result type 'int *' [-Wincompatible-pointer-types]
   42 |     return &total;
      |            ^~~~~~
sexy-time.c:42:13: warning: address of stack memory associated with local variable 'total' returned [-Wreturn-stack-address]
   42 |     return &total;
      |             ^~~~~
sexy-time.c:45:19: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   45 | int* convert_time(int64_t seconds) {
      |                   ^~~~~~~
      |                   __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:45:6: error: conflicting types for 'convert_time'
   45 | int* convert_time(int64_t seconds) {
      |      ^
sexy-time.c:19:12: note: previous implicit declaration is here
   19 |     return convert_time(duration);
      |            ^
sexy-time.c:46:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   46 |     int64_t h, m, s, d;
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:58:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   58 |     int64_t fraction = seconds - ((int64_t)h * 3600 + (int64_t)m * 60 + (int64_t)s);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:58:36: error: use of undeclared identifier 'int64_t'
   58 |     int64_t fraction = seconds - ((int64_t)h * 3600 + (int64_t)m * 60 + (int64_t)s);
      |                                    ^
sexy-time.c:61:16: warning: incompatible pointer types returning '__int64_t *' (aka 'long *') from a function with result type 'int *' [-Wincompatible-pointer-types]
   61 |         return &h;
      |                ^~
sexy-time.c:61:17: warning: address of stack memory associated with local variable 'h' returned [-Wreturn-stack-address]
   61 |         return &h;
      |                 ^
sexy-time.c:64:59: warning: format specifies type 'int' but the argument has type '__int64_t' (aka 'long') [-Wformat]
   64 |         snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%02d", h, m, s, fraction);
      |                                     ~~~~                  ^
      |                                     %02ld
sexy-time.c:64:62: warning: format specifies type 'int' but the argument has type '__int64_t' (aka 'long') [-Wformat]
   64 |         snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%02d", h, m, s, fraction);
      |                                          ~~~~                ^
      |                                          %02ld
sexy-time.c:64:65: warning: format specifies type 'int' but the argument has type '__int64_t' (aka 'long') [-Wformat]
   64 |         snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%02d", h, m, s, fraction);
      |                                               ~~~~              ^
      |                                               %02ld
sexy-time.c:64:68: warning: format specifies type 'int' but the argument has type '__int64_t' (aka 'long') [-Wformat]
   64 |         snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%02d", h, m, s, fraction);
      |                                                    ~~~~            ^~~~~~~~
      |                                                    %02ld
sexy-time.c:65:17: warning: call to undeclared function 'buf_strlen'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   65 |         return &buf_strlen(buf);
      |                 ^
sexy-time.c:65:16: error: cannot take the address of an rvalue of type 'int'
   65 |         return &buf_strlen(buf);
      |                ^~~~~~~~~~~~~~~~
sexy-time.c:77:16: error: returning 'void' from a function with incompatible result type 'int'
   77 |         return usage("Failed to read input");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sexy-time.c:83:16: error: returning 'void' from a function with incompatible result type 'int'
   83 |         return usage("Failed to read input");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sexy-time.c:86:5: error: unknown type name 'int64_t'; did you mean '__int64_t'?
   86 |     int64_t result = sexagesimal_time(start_time, end_time);
      |     ^~~~~~~
      |     __int64_t
/usr/include/sys/_types.h:50:16: note: '__int64_t' declared here
   50 | typedef long                    __int64_t;
      |                                 ^
sexy-time.c:92:13: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
   92 |             char *output;
      |             ^
sexy-time.c:93:24: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
   93 |             if (output = convert_time(result)) {
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
sexy-time.c:93:24: note: place parentheses around the assignment to silence this warning
   93 |             if (output = convert_time(result)) {
      |                        ^
      |                 (                            )
sexy-time.c:93:24: note: use '==' to turn this assignment into an equality comparison
   93 |             if (output = convert_time(result)) {
      |                        ^
      |                        ==
19 warnings and 19 errors generated.

i thought it would an interesting test trying to convert a shell script into a c program

i dont know any c,
so i couldnt say how close it got to create a working c version of the script

id be interested if anyone who knows c would evaluate the response and see how far off it was
 
Im not sure with new deepseek, but if you want to try for programming - try deepseek-coder. i have not tried deepseek-coder v2 but used deepseek-coder v1 . kinda liked but i need to learn how to quantisize models as v2 have only 2 sizes to choose in ollama ( small or large and v1 had 3 or 4 sizes).
Deepseek-coder is kinda popular for programming
I think llama.cpp needs to be tested and learned.
 
i have deepseek-coder installed as well
ill give that a go as well

deepseek is now on the ios app store as well i think

i gave deepseek-r1 a prompt saying

what happened in china in 1989

and it mentioned Tiananmen square

some news reports suggested deepseek would shut down the conversation if you asked certain questions
 
Back
Top