bennetthardwick / darknet.js

A NodeJS wrapper of pjreddie's darknet / yolo.
65 stars 27 forks source link

need to modifly ARCH= in darknet Makefile #37

Closed vajonam closed 3 years ago

vajonam commented 3 years ago

@bennetthardwick I finally got a GPU and while comping darknet for GPU, I found that I need to be able to specify the ARCH= for my GPU in the darknet makefile. Can you please add a DARKNET_ARCH enviroment variable I can set to be able to override the ARCH= setting in the darknet makefile.

it seems that some arch's have been deprecated and cause compile issues on darknet.

vajonam commented 3 years ago

I found the regex that matches the existing block, ^ARCH=\.*[\s\S]*\] but sed needs to do acrobatics when doing multiline replacements.

vajonam commented 3 years ago

that seems to do the trick,

perl -0777 -pe 's/^ARCH=\.*[\s\S]*\]/ARCH=FOOBAR/gm' -i Makefile

will leave to your on if you want to use perl

bennetthardwick commented 3 years ago

Do you need to override the whole thing or just add one to the beginning?

vajonam commented 3 years ago

I actually need to remove a line from the begning

From Yolov4 readme

You also need to specify for which graphics card the code is generated. This is done by setting ARCH=. If you use a never version than CUDA 11 you further need to edit line 20 from Makefile and remove -gencode arch=compute_30,code=sm_30 \ as Kepler GPU support was dropped in CUDA 11. You can also drop the general ARCH= and just uncomment ARCH= for your graphics card.

I would like to override the whole thing, gives the most control, I was thinking something like

export DARKNET_BUILD_ARCH="-gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61"

and have this replace the Makefile.

vajonam commented 3 years ago

@bennetthardwick ping.. can you add this, I would like to avoid the steps of hand editing the Makefile during my container build. Thanks so much.

bennetthardwick commented 3 years ago

Hey sorry about the delay, I pushed f80401b and published 3.0.4. Let me know if that doesn't work for you :+1:

vajonam commented 3 years ago

@bennetthardwick works perfectly thanks!