{"action":"created","issue":{"url":"https://api.github.com/repos/amusecode/amuse/issues/7","labels_url":"https://api.github.com/repos/amusecode/amuse/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/amusecode/amuse/issues/7/comments","events_url":"https://api.github.com/repos/amusecode/amuse/issues/7/events","html_url":"https://github.com/amusecode/amuse/issues/7","id":111961286,"number":7,"title":"Seeding new_fractal_cluster_model","user":{"login":"iambernie","id":2105396,"avatar_url":"https://avatars.githubusercontent.com/u/2105396?v=3","gravatar_id":"","url":"https://api.github.com/users/iambernie","html_url":"https://github.com/iambernie","followers_url":"https://api.github.com/users/iambernie/followers","following_url":"https://api.github.com/users/iambernie/following{/other_user}","gists_url":"https://api.github.com/users/iambernie/gists{/gist_id}","starred_url":"https://api.github.com/users/iambernie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iambernie/subscriptions","organizations_url":"https://api.github.com/users/iambernie/orgs","repos_url":"https://api.github.com/users/iambernie/repos","events_url":"https://api.github.com/users/iambernie/events{/privacy}","received_events_url":"https://api.github.com/users/iambernie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-17T12:26:28Z","updated_at":"2015-10-19T19:37:12Z","closed_at":null,"body":" I'm trying to create 100 fractal clusters with new_fractal_cluster_model(),\r\nwith the following piece of code (makefractals.py).\r\n\r\n```python\r\nfrom amuse.ic.fractalcluster import new_fractal_cluster_model\r\n\r\nfor i in range(100):\r\n    print(i)\r\n    model = new_fractal_cluster_model(N=100, random_seed=i)\r\n```\r\nbut running makefractals.py however, throws the following exception:\r\n```\r\nlaub @ F036961: ~% amuse makefractals.py \r\n0\r\n1\r\n[...]\r\n43\r\n44\r\nTraceback (most recent call last):\r\n  File \"makefractals.py\", line 7, in <module>\r\n    model = new_fractal_cluster_model(N=100, random_seed=i)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 272, in new_fractal_cluster_model\r\n    return uc.result\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 250, in result\r\n    particles = self.new_model()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 241, in new_model\r\n    generator.generate_particles()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 189, in generate_particles\r\n    result = self.overridden().generate_particles()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 107, in __call__\r\n    result = self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 107, in __call__\r\n    result = self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 196, in __call__\r\n    return self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/rfi/core.py\", line 106, in __call__\r\n    raise exceptions.CodeException(\"Exception when calling function '{0}', of code '{1}', exception was '{2}'\".format(self.specification.name, type(self.interface).__name__, ex))\r\namuse.support.exceptions.CodeException: Exception when calling function 'generate_particles', of code 'FractalClusterInterface', exception was 'lost connection to code'\r\n--------------------------------------------------------------------------\r\nmpiexec has exited due to process rank 0 with PID 8138 on\r\nnode F036961 exiting improperly. There are three reasons this could occur:\r\n\r\n1. this process did not call \"init\" before exiting, but others in\r\nthe job did. This can cause a job to hang indefinitely while it waits\r\nfor all processes to call \"init\". By rule, if one process calls \"init\",\r\nthen ALL processes must call \"init\" prior to termination.\r\n\r\n2. this process called \"init\", but exited without calling \"finalize\".\r\nBy rule, all processes that call \"init\" MUST call \"finalize\" prior to\r\nexiting or it will be considered an \"abnormal termination\"\r\n\r\n3. this process called \"MPI_Abort\" or \"orte_abort\" and the mca parameter\r\norte_create_session_dirs is set to false. In this case, the run-time cannot\r\ndetect that the abort call was an abnormal termination. Hence, the only\r\nerror message you will receive is this one.\r\n\r\nThis may have caused other processes in the application to be\r\nterminated by signals sent by mpiexec (as reported here).\r\n\r\nYou can avoid this message by specifying -quiet on the mpiexec command line.\r\n```\r\n\r\nI've also tried randomizing the seeds like so (makefractals2.py):\r\n\r\n```python\r\nfrom amuse.ic.fractalcluster import new_fractal_cluster_model\r\n\r\nimport random\r\n\r\nrandom.seed(1)\r\nseeds = [random.randint(1,10000) for i in range(1000)]\r\n\r\nfor i, s in enumerate(seeds):\r\n    print(i,s)\r\n    model = new_fractal_cluster_model(N=100, random_seed=s)\r\n```\r\n\r\nThis will throw the same exception after 164 models.\r\n\r\n```\r\nlaub @ F036961: ~% amuse makefractals2.py\r\n(0, 1344)\r\n(1, 8475)\r\n[...]\r\n(163, 6486)\r\n(164, 3949)\r\nTraceback (most recent call last):\r\n  File \"makefractals2.py\", line 10, in <module>\r\n    model = new_fractal_cluster_model(N=100, random_seed=s)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 272, in new_fractal_cluster_model\r\n    return uc.result\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 250, in result\r\n    particles = self.new_model()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 241, in new_model\r\n    generator.generate_particles()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/community/fractalcluster/interface.py\", line 189, in generate_particles\r\n    result = self.overridden().generate_particles()\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 107, in __call__\r\n    result = self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 107, in __call__\r\n    result = self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/support/methods.py\", line 196, in __call__\r\n    return self.method(*list_arguments, **keyword_arguments)\r\n  File \"/home/laub/software/amuse-10.0/src/amuse/rfi/core.py\", line 106, in __call__\r\n    raise exceptions.CodeException(\"Exception when calling function '{0}', of code '{1}', exception was '{2}'\".format(self.specification.name, type(self.interface).__name__, ex))\r\namuse.support.exceptions.CodeException: Exception when calling function 'generate_particles', of code 'FractalClusterInterface', exception was 'lost connection to code'\r\n--------------------------------------------------------------------------\r\nmpiexec has exited due to process rank 0 with PID 10434 on\r\nnode F036961 exiting improperly. There are three reasons this could occur:\r\n\r\n[cut mpiexec error messages]\r\n```\r\n\r\nCan anybody confirm/reproduce this behaviour of new_fractal_cluster_model?"},"comment":{"url":"https://api.github.com/repos/amusecode/amuse/issues/comments/149322502","html_url":"https://github.com/amusecode/amuse/issues/7#issuecomment-149322502","issue_url":"https://api.github.com/repos/amusecode/amuse/issues/7","id":149322502,"user":{"login":"iambernie","id":2105396,"avatar_url":"https://avatars.githubusercontent.com/u/2105396?v=3","gravatar_id":"","url":"https://api.github.com/users/iambernie","html_url":"https://github.com/iambernie","followers_url":"https://api.github.com/users/iambernie/followers","following_url":"https://api.github.com/users/iambernie/following{/other_user}","gists_url":"https://api.github.com/users/iambernie/gists{/gist_id}","starred_url":"https://api.github.com/users/iambernie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iambernie/subscriptions","organizations_url":"https://api.github.com/users/iambernie/orgs","repos_url":"https://api.github.com/users/iambernie/repos","events_url":"https://api.github.com/users/iambernie/events{/privacy}","received_events_url":"https://api.github.com/users/iambernie/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T19:37:12Z","updated_at":"2015-10-19T19:37:12Z","body":"> [...] but the fractal cluster may now return with less particles than requested\r\n\r\nI suppose this is inherent to how the fractal generation algorithm works? \r\n\r\nI think calling `new_fractal_cluster_model(N=100)` should always return 100 particles, you seem to have fixed this with the `match_N` option. And if I understand correctly, what `match_N=True` does, is call the fractal generation code again with a different seed until a fractal is made with the required number of particles. \r\n\r\nIt sounds as if we now don't have the guarantee that if I call `new_fractal_cluster_model(N=100, random_seed=s, match_N=True)` with S different seeds, I will get back S unique fractals due to possible seed reuse? (Btw, even if this is so, I still think it's quite acceptable)"}}