First time here? Checkout the FAQ!
x
0 votes
by (1.2k points)

I am attempting to call a custom .so file that I have compiled with the provided script. I have used the following commands: 

--num_external_imp 1 

--external_imp[0] "./my_GPB.so" 

--imp_region[0].im "my_GPB"

However, with these commands I get an "unrecognized argument" error message that looks like this: (I will provide full output in the comments below)

error: unrecognized arguments: --num_external_imp 1 --external_imp[0] ./my_GPB.so --imp_region[0].im my_GPB

What am I doing wrong?

by (1.2k points)
(base) buggus-mbp:my_experiment buggu$ python3 ./test.py

================================================================================

SETTINGS SUMMARY

================================================================================

Executables

--------------------------------------------------------------------------------

   CARP:              /usr/local/bin/openCARP

   MESHER:            /usr/local/bin/mesher

   BENCH:             /usr/local/bin/bench

   IGBHEAD:           /usr/local/bin/igbhead

   IGBOPS:            /usr/local/bin/igbops

   IGBEXTRACT:        /usr/local/bin/igbextract

   IGBAPD:            /usr/local/bin/igbapd

   MESHALYZER:        /usr/local/meshalyzer/meshalyzer

   SV2H5B:            /Users/buggu/.local/lib/python3.8/site-packages/bin/bin2h5.py

   SV2H5T:            /Users/buggu/.local/lib/python3.8/site-packages/bin/txt2h5.py

   CLOSEST_HC:        /Users/buggu/.local/lib/python3.8/site-packages/bin/closest_hc

   APDRESTITUTION:    /Users/buggu/.local/lib/python3.8/site-packages/bin/APDrestitution

   TUNECV:            /Users/buggu/.local/lib/python3.8/site-packages/bin/tuneCV

   RESTITUTECV:       /Users/buggu/.local/lib/python3.8/site-packages/bin/restituteCV

   MESHTOOL:          /usr/local/bin/meshtool

--------------------------------------------------------------------------------

Command Line Options

--------------------------------------------------------------------------------

   NP:        1

   BUILD:     CPU

   FLAVOR:    petsc

   DRY:       False

   VISUALIZE: False

--------------------------------------------------------------------------------

Solver Option Files

--------------------------------------------------------------------------------

   Parabolic: /Users/buggu/.local/lib/python3.8/site-packages/carputils/resources/petsc_options/ilu_cg_opts

   Elliptic:  /Users/buggu/.local/lib/python3.8/site-packages/carputils/resources/petsc_options/amg_cg_opts

--------------------------------------------------------------------------------

System Info

--------------------------------------------------------------------------------

   Python:    3.8.5

   OS:        Unknown

   SETTINGS:  /Users/buggu/.config/carputils/settings.yaml

   Email:     you@example.com

================================================================================



/Users/buggu/Desktop/my_experiment/TEST_2021-07-08_tunecv_300.0_petsc_np1 does already exist...

/Users/buggu/.local/lib/python3.8/site-packages/bin/tuneCV \

  --resolution 100.0 \

  --length 0.1 \

  --gi 0.174 \

  --ge 0.625 \

  --ts 1 \

  --modelpar GNa*0.5 \

  --num_external_imp 1 \

  --external_imp[0] ./my_GPB.so \

  --imp_region[0].im my_GPB



usage: tuneCV [-h] [--np NP] [--np-job NP_JOB] [--tpp TPP]

              [--runtime HH:MM:SS] [--build {CPU}]

              [--flavor {petsc,boomeramg,parasails,pt,direct}]

              [--platform {desktop,archer,archer2,archer_intel,archer_camel,curie,marconi,marconi_slurm,marconi_debug,medtronic,mephisto,smuc_f,smuc_t,smuc_i,vsc2,vsc3,vsc4,wopr}]

              [--queue QUEUE] [--vectorized-fe VECTORIZED_FE] [--dry-run]

              [--checkpoint CHECKPOINT] [--restore RESTORE]

              [--generate-parfile GENERATE_PARFILE]

              [--polling-param POLLING_PARAM [POLLING_PARAM ...]]

              [--polling-range min:max:num [min:max:num ...]]

              [--polling-file POLLING_FILE]

              [--sampling-type {linear,geometric,lhs}] [--stress-models]

              [--material-models] [--ionic-models] [--CARP-opts CARP_OPTS]

              [--postprocess {phie,optic,activation,axial,filament,efield,mechanics} [{phie,optic,activation,axial,filament,efield,mechanics} ...]]

              [--gdb [PROC [PROC ...]]] [--lldb [PROC [PROC ...]]]

              [--ddd [PROC [PROC ...]]] [--ddt] [--valgrind [OUTFILE]]

              [--valgrind-options [OPT=VAL [OPT=VAL ...]]] [--map]

              [--scalasca] [--ID ID] [--suffix SUFFIX]

              [--overwrite-behaviour {prompt,error,delete,overwrite,append}]

              [--silent] [--visualize] [--mech-element {P1-P0,P1-P1-DB,MINI}]

              [--mech-with-inertia] [--webGUI] [--resolution RESOLUTION]

              [--length LENGTH] [--model MODEL] [--modelpar MODELPAR]

              [--plugin PLUGIN] [--plugpar PLUGPAR] [--svinit SVINIT]

              [--dynamic-libs LIB1:LIB2:...] [--velocity VELOCITY] [--gi GI]

              [--ge GE] [--beta BETA]

              [--sourceModel {monodomain,bidomain,pseudo_bidomain}]

              [--tol TOL] [--converge [CONVERGE]] [--maxit MAXIT] [--dt DT]

              [--stimS STIMS] [--ts {0,1}] [--stol STOL] [--lumping LUMPING]

              [--opsplit OPSPLIT] [--log LOG] [--clean]

error: unrecognized arguments: --num_external_imp 1 --external_imp[0] ./my_GPB.so --imp_region[0].im my_GPB

Traceback (most recent call last):

  File "./test.py", line 152, in <module>

    run()

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/tools.py", line 505, in wrapped

    ret = run(args, job)

  File "./test.py", line 145, in run

    execute(args, job, modelpar=mod, custom = True)

  File "./test.py", line 136, in execute

    job.bash(cmd)

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/job/job.py", line 242, in bash

    self.register(ShellCommand(cmd, message), *args, **kwargs)

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/job/job.py", line 119, in register

    self._queue.pop(0).execute()

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/job/command.py", line 163, in execute

    divertoutput.call(self._cmd, stdout=self._stdout, stderr=self._stderr)

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/divertoutput.py", line 43, in wrapped

    return func(cmd, *args, **kwargs)

  File "/Users/buggu/.local/lib/python3.8/site-packages/carputils/divertoutput.py", line 147, in call

    raise subprocess.CalledProcessError(proc.returncode, cmd[0])

subprocess.CalledProcessError: Command '/Users/buggu/.local/lib/python3.8/site-packages/bin/tuneCV' returned non-zero exit status 1.

2 Answers

0 votes
by (3.5k points)
selected by
 
Best answer

Hi,

To load an external ionic model you should use: '-external_imp[Int]'. For more information you can refer to our online documentation openCARP parameters | openCARP or check the help from openCARP using openCARP +Help.

Cheers,

Jorge

by (1.2k points)
Within carputils, I have been trying to use

cmd +=
[...,  
'--external_imp[0]', "./my_GPB.so"
 ,...]

Is this the wrong syntax?
by (17.5k points)
Hi,

it depends to which tool you want to provide the option. If it goes to openCARP directly, there is only one "-" (and not "--").
You can see an example here: https://git.opencarp.org/openCARP/experiments/-/blob/master/tutorials/02_EP_tissue/01_basic_usage/run.py#L221

tuneCV does not provide specific support for shared library ionic models but you can use the --CARP-opts parameter to pass them.

Loading external ionic models as a shared library is described in this example: https://opencarp.org/documentation/examples/01_ep_single_cell/04_limpet_fe#parameter-files
Tuning CV is introduced in this example: https://opencarp.org/documentation/examples/02_ep_tissue/03a_study_prep_tunecv
by (1.2k points)
Hi Axel,

Thanks for getting back to me. Following your advice, I have used --CARP-opts to load the following options: -num_external_imp 1 -external_imp[0] ./my_GPB.so -imp_region[0].im my_GPB

The tuneCV log shows that these options were passed correctly into openCARP. However, I am getting back an L5 : Illegal IM specified: my_GPB error.

Is there anything else I should be doing? (For instance, modifying imp-lists.txt?) I have checked that my model loads correctly in bench, so it should not be a path issue...
by (17.5k points)
Did you enable dynamic library support when building openCARP?

For CMake, this means to pass -DDLOPEN=ON when calling CMake. If you use the makefile, this means setting DLOPEN=1 in the my_switches.def file.
by (1.2k points)
This solved the problem! This was a mistake on my part - I had installed the openCARP binary without -DDLOPEN=ON.

Thank you for your help.
0 votes
by (3.4k points)
Hi,

I don't know it well but I had a look at tuneCV, and it seems that you can't call this script using an external ionic model.

I hope someone can help you more about it, but I think you should consider using the carp command in order to run your simulation.

Cheers,

Marie
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...